Can anyone tell me how to convert hexidecimal to RGB and RGB to hexidecimal
Printable View
Can anyone tell me how to convert hexidecimal to RGB and RGB to hexidecimal
are you talking about the given values? like R=255, G=0, B=0 makes the color Red? if so, then there really isn't a need for conversion. just a need to see the information in a different state. 255 =#FF=100% red. 0=#00=0%Green etc..
instead of displaying as a number, display as a hex.
So how do I convert the vales like 255 into hex in code.
Here is what is available from the search function in VB
*
Example
This example uses the Hex function to return the hexadecimal value of a number.
Dim MyHex As String
MyHex = Hex(5) ' Returns 5.
MyHex = Hex(10) ' Returns A.
MyHex = Hex(459) ' Returns 1CB.
*
just reference the 5, or 10, or 459 in the above example to an integer for that specific color.
If you need an ARGB value there is a method in the color class that is called "ConvertFromHtml" ot something like that, I don't have dev studio right now, just pass the hex code and it will serve you an argb color object....
kind regards
Henrik