standard way of getting color # string from drawing.color?

Discussion in 'ASP .Net' started by PJ6, Sep 15, 2005.

  1. PJ6

    PJ6 Guest

    I can't find any built-in way to do this. I'm assigning an HTML cell a
    bgcolor and want to do it from a real color FromArgb... how do I get the #
    string to assign it to the HTML cell? Or do I have to code a translator up
    myself?

    TIA,
    Paul
     
    PJ6, Sep 15, 2005
    #1
    1. Advertisements

  2. Paul,

    System.Drawing.Color.FromArgb([argb color here])


    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
     
    S. Justin Gengo, Sep 15, 2005
    #2
    1. Advertisements

  3. Paul,

    I was re-reading and realized that you may have also meant you want the full
    conversion to a html table cell color. That's like this:

    Dim ColorTranslator As System.Drawing.ColorTranslator

    Dim HtmlColor As String = ColorTranslator.ToHtml(System.Drawing.Color.Red)

    If you are using a server side control for your table. Then you'll be able
    to assign the color with the method I showed you previously. If you want the
    actual RGB color (i.e. #FFFFFF) Then that's the code above.


    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
     
    S. Justin Gengo, Sep 15, 2005
    #3
  4. PJ6

    PJ6 Guest

    Why don't you read my question again.

    Paul

     
    PJ6, Sep 15, 2005
    #4
  5. PJ6

    PJ6 Guest

    Aha! I knew there was something built in.

    Thanks,
    Paul

     
    PJ6, Sep 15, 2005
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.