This program uses Horizontal Scroll Bars and variables to create a colour palette.
Create a Form with the following objects:
3 Horizontal Scroll Bars
4 Text Boxes
3 Labels
Size and arrange the objects as shown.
Change the label captions to Red, Green and Blue.
The variables r, g and b represent the colour numbers
for red, green and blue.
Declare these variables under "general" in the code window.
(Dim r as Integer, etc.)
Here is the code for this program:
Dim r As Integer
Dim g As Integer
Dim b As Integer
Private Sub HScroll1_Change()
r = HScroll1.Value
Text2.Text = r
Text1.BackColor = RGB(r, g, b)
End Sub
Private Sub HScroll2_Change()
g = HScroll2.Value
Text3.Text = g
Text1.BackColor = RGB(r, g, b)
End Sub
Private Sub HScroll3_Change()
b = HScroll3.Value
Text4.Text = b
Text1.BackColor = RGB(r, g, b)
End Sub
"Start"