Results 1 to 4 of 4

Thread: Hexadecimal and RGB

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2000
    Location
    Mexico City
    Posts
    306

    Talking

    Hi guys!!!

    How can I convert a RGB value to hexadecimal and viceversa?

  2. #2
    Addicted Member
    Join Date
    Sep 2000
    Posts
    138
    It seems that VB uses a 4-byte long integer to represent color, the high byte being 0 and the three lower bytes being, from lowest onward, RRGGBB, i.e., &HBBGGRR. So RGB(255,255,255) = &HFFFFFF; RGB(123,0,33) = &H21007B, and so on. &H80 in the high byte represents a Windows system color.

    Hope it helps.

  3. #3
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930

    A little addition

    You can easily convert numbers into hex using either the Hex() (returns variant), or Hex$() (returns a string) functions. Converting from hex to some other base requires an algorithm however. If you really want it, I have one, but if you look you can probably find one faster than I can dig mine up at home .
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2000
    Location
    Mexico City
    Posts
    306

    Smile

    Thank you very much!!!

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