Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: how to assign color properites using hex


Message #1 by "paulcr" <paulcr@c...> on Wed, 13 Feb 2002 21:36:20 -0000
Hi

I have all my colors listed in hex, I want to assign a color to a

label.backColor. Thought it would be easy i.e.: myLabel.BackColor 

"#9999F3" .

But nahh

This is proving to be a rather complex, how do I do it?





Message #2 by "Alvin Ling" <alvin.ling@i...> on Wed, 13 Feb 2002 16:56:16 -0500
You can declare it in the control itself:



<asp:label id="myLabel" forecolor="#9999F3" runat="server" />



Or programmatically using the System.Drawing namespace:



myLabel.BackColor = System.Drawing.Color.Red





Alvin



> -----Original Message-----

> From: paulcr [mailto:paulcr@c...] 

> Sent: Wednesday, February 13, 2002 4:36 PM

> To: aspx_beginners

> Subject: [aspx_beginners] how to assign color properites using hex

> 

> 

> Hi

> I have all my colors listed in hex, I want to assign a color 

> to a label.backColor. Thought it would be easy i.e.: 

> myLabel.BackColor = "#9999F3" . But nahh This is proving to 

> be a rather complex, how do I do it?

> 

> 

> 




> $subst('Email.Unsub').

> 

> 









Message #3 by "paulcr" <paulcr@c...> on Wed, 13 Feb 2002 22:01:06 -0000
Yes thanx I just figured it out by trying out some of the methods of the

Color object.

I wanted to use code behind to assign colors on server dependant on the

request parameters, I found this works too:

Color myColor = Color.FromName("FF6F29");

lblMyLabel.BackColor = myColor;



thanks for the reply



>

> You can declare it in the control itself:

>

> <asp:label id="myLabel" forecolor="#9999F3" runat="server" />

>

> Or programmatically using the System.Drawing namespace:

>

> myLabel.BackColor = System.Drawing.Color.Red

>

>

> Alvin

>

> >

> > Hi

> > I have all my colors listed in hex, I want to assign a color

> > to a label.backColor. Thought it would be easy i.e.:

> > myLabel.BackColor = "#9999F3" . But nahh This is proving to

> > be a rather complex, how do I do it?

> >

> >

> >

> > ---








  Return to Index