Results 1 to 5 of 5

Thread: VB Color Constant to HTML color code {RESOLVED}

  1. #1

    Thread Starter
    Frenzied Member andreys's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,615

    VB Color Constant to HTML color code {RESOLVED}

    Does anybody know convert VB ColorCionstant to HTML color code, like

    17849940 to #C0C0C0
    Last edited by andreys; Dec 23rd, 2002 at 05:46 PM.

  2. #2
    Hyperactive Member DovyWeiss's Avatar
    Join Date
    Feb 2002
    Location
    Miami Beach, FL
    Posts
    366
    An HTML color code is, I think, a "#" sign followed by three two-character hexadecimal values for the red, green, and blue, and I think that's the right order.

    There are plenty of GetRed/GetGreen/GetBlue functions around, and the Hex$ or Hex function will convert from decimal to hexadecimal.

    So: HTMLCode$ = "#" & Str(GetRed(myColor)) & Str(GetGreen(myColor)) & Str(GetBlue(myColor))

    Just off the top of my head, hope it works!

  3. #3

    Thread Starter
    Frenzied Member andreys's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,615
    Thanks. I used Hex function as you suggested. It works now.

  4. #4
    Hyperactive Member DovyWeiss's Avatar
    Join Date
    Feb 2002
    Location
    Miami Beach, FL
    Posts
    366
    No problem. Post if you have more trouble.

  5. #5
    Lively Member
    Join Date
    Sep 2002
    Posts
    89
    If you want to use the VB Colour constants (like vbInfoBackground and vbButtonFace), then you need to translate those values to actual RGB values first using the OleTranslateColor API call

    - gaffa

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