about colors and numbers

Discussion in 'ASP .Net' started by Alex D., Sep 7, 2005.

  1. Alex D.

    Alex D. Guest

    can anybody tell me how to assign a color as a number? I couldnt find
    anything for that in System.Drawing.
    Example of what I need to do:
    TextBox1.BackColor = "#A8D3FF";

    Thanks,
    Alex.
     
    Alex D., Sep 7, 2005
    #1
    1. Advertising

  2. Hi Alex,

    Try System.Drawing.Color.FromArgb(168,211,255) or
    System.Drawing.Color.FromArgb(CType(&HA8, Integer), CType(&HD3, Integer),
    CType(&HFF, Integer))

    http://msdn.microsoft.com/library/d...frlrfsystemdrawingcolorclassfromargbtopic.asp

    --
    HTH,
    Phillip Williams
    http://www.societopia.net
    http://www.webswapp.com


    "Alex D." wrote:

    > can anybody tell me how to assign a color as a number? I couldnt find
    > anything for that in System.Drawing.
    > Example of what I need to do:
    > TextBox1.BackColor = "#A8D3FF";
    >
    > Thanks,
    > Alex.
    >
    >
    >
     
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=, Sep 7, 2005
    #2
    1. Advertising

  3. Alex D.

    Lucas Tam Guest

    "Alex D." <> wrote in news:OA4msD#sFHA.3404
    @TK2MSFTNGP09.phx.gbl:

    > can anybody tell me how to assign a color as a number? I couldnt find
    > anything for that in System.Drawing.
    > Example of what I need to do:
    > TextBox1.BackColor = "#A8D3FF";



    I believe you'll need to convert the colour into RGB first.., and then use
    System.Drawing.Color.FromArgb


    --
    Lucas Tam ()
    Please delete "REMOVE" from the e-mail address when replying.

    Newmarket Volvo Sucks! http://newmarketvolvo.tripod.com
     
    Lucas Tam, Sep 7, 2005
    #3
  4. Alex D.

    Lucas Tam Guest

    "Alex D." <> wrote in news:OA4msD#sFHA.3404
    @TK2MSFTNGP09.phx.gbl:

    > can anybody tell me how to assign a color as a number? I couldnt find
    > anything for that in System.Drawing.
    > Example of what I need to do:
    > TextBox1.BackColor = "#A8D3FF";



    or try System.drawing.color.fromname... that might work too


    --
    Lucas Tam ()
    Please delete "REMOVE" from the e-mail address when replying.

    Newmarket Volvo Sucks! http://newmarketvolvo.tripod.com
     
    Lucas Tam, Sep 7, 2005
    #4
  5. Alex,

    You should use the ColorTranslator's FromHtml Method:

    TextBox1.BackColor = System.Drawing.ColorTranslator.FromHtml("#00ff00");


    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    "Alex D." <> wrote in message
    news:OA4msD%...
    > can anybody tell me how to assign a color as a number? I couldnt find
    > anything for that in System.Drawing.
    > Example of what I need to do:
    > TextBox1.BackColor = "#A8D3FF";
    >
    > Thanks,
    > Alex.
    >
     
    S. Justin Gengo, Sep 7, 2005
    #5
  6. Thanks Justin. That seem to be the best solution.

    Alex.

    "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
    message news:eaTE$n%...
    > Alex,
    >
    > You should use the ColorTranslator's FromHtml Method:
    >
    > TextBox1.BackColor = System.Drawing.ColorTranslator.FromHtml("#00ff00");
    >
    >
    > --
    > Sincerely,
    >
    > S. Justin Gengo, MCP
    > Web Developer / Programmer
    >
    > www.aboutfortunate.com
    >
    > "Out of chaos comes order."
    > Nietzsche
    > "Alex D." <> wrote in message
    > news:OA4msD%...
    >> can anybody tell me how to assign a color as a number? I couldnt find
    >> anything for that in System.Drawing.
    >> Example of what I need to do:
    >> TextBox1.BackColor = "#A8D3FF";
    >>
    >> Thanks,
    >> Alex.
    >>

    >
    >
     
    Alejandro Penate-Diaz, Sep 8, 2005
    #6
  7. Thanks!

    "Phillip Williams" <> wrote in message
    news:...
    > Hi Alex,
    >
    > Try System.Drawing.Color.FromArgb(168,211,255) or
    > System.Drawing.Color.FromArgb(CType(&HA8, Integer), CType(&HD3, Integer),
    > CType(&HFF, Integer))
    >
    > http://msdn.microsoft.com/library/d...frlrfsystemdrawingcolorclassfromargbtopic.asp
    >
    > --
    > HTH,
    > Phillip Williams
    > http://www.societopia.net
    > http://www.webswapp.com
    >
    >
    > "Alex D." wrote:
    >
    >> can anybody tell me how to assign a color as a number? I couldnt find
    >> anything for that in System.Drawing.
    >> Example of what I need to do:
    >> TextBox1.BackColor = "#A8D3FF";
    >>
    >> Thanks,
    >> Alex.
    >>
    >>
    >>
     
    Alejandro Penate-Diaz, Sep 8, 2005
    #7
  8. Thanks Lucas!

    "Lucas Tam" <> wrote in message
    news:Xns96CAA3B66EEB8nntprogerscom@127.0.0.1...
    > "Alex D." <> wrote in news:OA4msD#sFHA.3404
    > @TK2MSFTNGP09.phx.gbl:
    >
    >> can anybody tell me how to assign a color as a number? I couldnt find
    >> anything for that in System.Drawing.
    >> Example of what I need to do:
    >> TextBox1.BackColor = "#A8D3FF";

    >
    >
    > I believe you'll need to convert the colour into RGB first.., and then use
    > System.Drawing.Color.FromArgb
    >
    >
    > --
    > Lucas Tam ()
    > Please delete "REMOVE" from the e-mail address when replying.
    >
    > Newmarket Volvo Sucks! http://newmarketvolvo.tripod.com
     
    Alejandro Penate-Diaz, Sep 8, 2005
    #8
    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. Subra
    Replies:
    25
    Views:
    1,261
    user923005
    Mar 8, 2007
  2. Andrew Tatum

    Fibonacci Numbers and Lucas Numbers

    Andrew Tatum, May 26, 2007, in forum: C++
    Replies:
    6
    Views:
    613
    Howard
    May 27, 2007
  3. Lance Hoffmeyer
    Replies:
    2
    Views:
    551
    Lance Hoffmeyer
    Jul 26, 2007
  4. AAaron123

    TreeNode colors come from anchor colors

    AAaron123, Aug 7, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    564
    darrel
    Aug 7, 2008
  5. ZelluX
    Replies:
    3
    Views:
    1,962
    Peter Otten
    Dec 1, 2008
Loading...

Share This Page