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. Advertising

  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
    "PJ6" <> wrote in message
    news:...
    >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
    >
     
    S. Justin Gengo, Sep 15, 2005
    #2
    1. Advertising

  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" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
    message news:...
    > 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
    > "PJ6" <> wrote in message
    > news:...
    >>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
    >>

    >
    >
     
    S. Justin Gengo, Sep 15, 2005
    #3
  4. PJ6

    PJ6 Guest

    Why don't you read my question again.

    Paul

    "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
    message news:...
    > 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
    > "PJ6" <> wrote in message
    > news:...
    >>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
    #4
  5. PJ6

    PJ6 Guest

    Aha! I knew there was something built in.

    Thanks,
    Paul

    "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
    message news:...
    > 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" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
    > message news:...
    >> 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
    >> "PJ6" <> wrote in message
    >> news:...
    >>>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
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    661
    Kevin Spencer
    Jan 9, 2006
  2. shapper

    System.Drawing.Color to String

    shapper, Oct 1, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    1,780
    John Timney \(MVP\)
    Oct 1, 2007
  3. defn noob
    Replies:
    1
    Views:
    415
    Mark Space
    Jun 28, 2008
  4. Kamaljeet Saini
    Replies:
    0
    Views:
    445
    Kamaljeet Saini
    Feb 13, 2009
  5. Xeno Campanoli / Eskimo North and Gmail
    Replies:
    2
    Views:
    184
    Phlip
    May 5, 2010
Loading...

Share This Page