VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Now change backcolor using 3 horizontal scroll bars and the RGB function. This is all there is to i

by David Koopman (11 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 28th December 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Now change backcolor using 3 horizontal scroll bars and the RGB function. This is all there is to it.

Rate Now change backcolor using 3 horizontal scroll bars and the RGB function. This is all there is to i



'Scroll bar properties(Make sure the min property is set to zero and max to 255).

Private Sub Form_Load()
    'Initialize form backcolor to black because Scroll bars load on 0.
    Me.BackColor = RGB(0, 0, 0)

End Sub


Private Sub hscBlue_Change()
    'Call function to update with new value
    slideColors

End Sub

Private Sub hscGreen_Change()
    'Call function to update with new value
    slideColors
    
End Sub

Private Sub hscRed_Change()
    'Call function to update with new value
    slideColors
    
End Sub

Private Function slideColors()
    'Declare variables
    Dim intRed As Integer
    Dim intGreen As Integer
    Dim intBlue As Integer
        'Set variables = Scroll values
        intRed = hscRed.Value
        intGreen = hscGreen.Value
        intBlue = hscBlue.Value
        
    Me.BackColor = RGB(intRed, intGreen, intBlue)
    'Optional labels to view the values of Scroll bars.
    Label4.Caption = intRed
    Label5.Caption = intGreen
    Label6.Caption = intBlue


End Function


Download this snippet    Add to My Saved Code

Now change backcolor using 3 horizontal scroll bars and the RGB function. This is all there is to i Comments

No comments have been posted about Now change backcolor using 3 horizontal scroll bars and the RGB function. This is all there is to i. Why not be the first to post a comment about Now change backcolor using 3 horizontal scroll bars and the RGB function. This is all there is to i.

Post your comment

Subject:
Message:
0/1000 characters