Hi Hawkeye,<br><br>Can you give an example? For instance, are you dealing with 6 digit hex values, or three separate ones?<br><br>It's my understanding that an RGB value is simply a 24 bit number where the most-significant byte represents Red, the next Green, and the least-significant byte represents Blue. If your hex value is in this format then it's already in RGB format.<br><br>If you have the colours as three separate hex values, then the RGB function will do the maths and assemble them into one 24-bit number.<br>e.g.<br> <br> 'These are integers.<br> MyRed = &H30<br> MyGreen = &HFF<br> MyBlue = &H10<br><br> 'MyRGB is a long.<br> MyRGB = RGB(MyRed, MyGreen, MyBlue)<br><br>will place the composite RGB value in MyRGB.<br><br>Hope this helps. Post more details if it doesn't.<br><br>Regards,<br>Tim
ok here is my example. I have a program that uses RGB values to show a color and HEX value. (#FFFFFF=white=255,255,255)<br><br>I want to let the user use the common dialog box to chooe a color, and then move the bars to the correct spots to represent the color.
not sure if this is of any help, but this is the source code of a very simple color choser I wrote<br>(R G B are the scrollbars, theres a Picture box, and a couple of labels, to show indivisual hex for r and g and so on, and one with them combine, only if its one digit, it shows 1 digit instead of 0F)<br><br>Option Explicit<br><br>Private Sub B_Change()<br>change<br>End Sub<br><br>Private Sub Form_Load()<br>change<br>End Sub<br><br>Private Sub G_Change()<br>change<br>End Sub<br><br>Private Sub R_Change()<br>change<br>End Sub<br><br>Sub change()<br>Picture1.BackColor = RGB(R.Value, G.Value, B.Value)<br>Label1.Caption = "# " & Hex(R.Value) & Hex(G.Value) & Hex(B.Value)<br>Label2.Caption = Hex(R.Value)<br>Label3.Caption = Hex(G.Value)<br>Label4.Caption = Hex(B.Value)<br>End Sub<br> <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href=
</a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
Here is one more example. I use the hex function on the commondialog color and then I need to get the correct RGB values out of each of the values.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.