Click to See Complete Forum and Search --> : HTML color picker
Ryan
Jan 15th, 2000, 03:24 PM
Is there a way to use the color picker that comes with the microsoft common dialog control to get html color codes? Or something else that I could look at so a user could click on a color and get a html color code from it?
Thanks in advanced.
DiGiTaIErRoR
Jan 15th, 2000, 03:42 PM
you need to convert the number to hex code
like black RGB(0,0,0) is 000000 and white RGB{255,255,255) is FFFFFF
------------------
DiGiTaIErRoR
Juan Carlos Rey
Jan 16th, 2000, 10:52 AM
Be careful that HTML uses RGB convention (Red, Green, Blue) but VB uses BGR (Blue, Green, Red)
Joacim Andersson
Jan 16th, 2000, 03:42 PM
Here's a function you can try:
Public Function RGBHexColor(lngColor As Long) As String
Dim sHex As String
sHex = Hex(lngColor)
sHex = Right$("000000" & sHex, 6)
sHex = Right$(sHex, 2) & Mid$(sHex, 3, 2) & Left$(sHex, 2)
RGBHexColor = sHex
End Function
Just call this function and pass the color the CommonDialog returns.
Good luck!
------------------
Joacim Andersson
joacim@programmer.net
joacim@yellowblazer.com
www.YellowBlazer.com (http://www.YellowBlazer.com)
rino_2
Jan 17th, 2000, 11:50 AM
Hi Ryan,
I made a program to help me with hex colours. You can download it here:
http://members.xoom.com/rino_2/HexColour.zip
I hope you like it.
------------------
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.