Results 1 to 5 of 5

Thread: How to convert RGB to Hex and vice versa

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982

    How to convert RGB to Hex and vice versa

    Can anyone tell me how to convert hexidecimal to RGB and RGB to hexidecimal


    Things I do when I am bored: DotNetable

  2. #2
    New Member
    Join Date
    Apr 2004
    Posts
    5
    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.
    loser

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    So how do I convert the vales like 255 into hex in code.


    Things I do when I am bored: DotNetable

  4. #4
    New Member
    Join Date
    Apr 2004
    Posts
    5
    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.
    loser

  5. #5
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width