This program shows you the RGB colours. You can change the values of each colour from 0 - 255 and you will see the special mixed colour, when you hit the commandbutton.
Out of 3 decimal numbers one hexadecimal number is build as a string using the following code:
sHEX = Hex$(r,2) & Hex$(g,2) & Hex$(b,2) sHEX = "&H" & sHEX & "&"
To get the program going , you need 1 commandbutton, 1 drawingarea, 3 textboxes and 3 textlabels.
How does that look alike ? See it here ( in German )
The Code:
PUBLIC SUB Button1_Click() DIM sHex AS String DIM r AS Integer DIM g AS Integer DIM b AS Integer IF Textbox1.text = "" THEN Textbox1.Text = 0 IF Textbox2.text = "" THEN Textbox2.Text = 0 IF Textbox3.text = "" THEN Textbox3.Text = 0 r = Val(Textbox1.Text) g = Val(Textbox2.Text) b = Val(Textbox3.Text) sHEX = Hex$(r,2) & Hex$(g,2) & Hex$(b,2) sHEX = "&H" & sHEX & "&" DrawingArea1.BackColor = Val(sHEX) END
-- ReinerHoffmann - 01 Feb 2004