Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Numeric values of Color.....

Reply
Thread Tools

Numeric values of Color.....

 
 
Jack Smith
Guest
Posts: n/a
 
      11-05-2004
I am using Image button and its property backcolor = DarkGray.

How to find out the numeric value of this color?

Thanks,

Jack


 
Reply With Quote
 
 
 
 
Kyle Eberle
Guest
Posts: n/a
 
      11-06-2004
I assume by numeric value you mean the RGB values associated with that
color.

The values should then be in the Color.R, Color.G and Color.B byte values.
If you need to convert them to hex you can do something like this:

ImageButton.BackColor.R.ToString("X2");
ImageButton.BackColor.G.ToString("X2");
ImageButton.BackColor.B.ToString("X2");

If you are pulling the color by name you might have to do this:
System.Drawing.Color myColor = System.Drawing.Color.FromName("DarkGray");

Hope that helps,
Kyle



"Jack Smith" <> wrote in message
news:#...
> I am using Image button and its property backcolor = DarkGray.
>
> How to find out the numeric value of this color?
>
> Thanks,
>
> Jack
>
>



 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      11-06-2004
the w3c standard:

http://www.w3.org/TR/REC-html40/types.html#h-6.5

microsoft extensions:

http://msdn.microsoft.com/library/de..._namecodes.asp

-- bruce (sqlwork.com)


"Jack Smith" <> wrote in message
news:%...
| I am using Image button and its property backcolor = DarkGray.
|
| How to find out the numeric value of this color?
|
| Thanks,
|
| Jack
|
|


 
Reply With Quote
 
Karl Seguin
Guest
Posts: n/a
 
      11-06-2004
The best way is to use the ColorTranslator:

Color c = ColorTranslator.FromHtml("DarkGray");
Response.Write(c.R);
Response.Write(c.G);
Response.Write(c.B);

which is located in System.Drawing (you'll need to reference that dll).

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


"Jack Smith" <> wrote in message
news:%...
> I am using Image button and its property backcolor = DarkGray.
>
> How to find out the numeric value of this color?
>
> Thanks,
>
> Jack
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
int to numeric numeric(18,2) ? jobs ASP .Net 2 07-22-2007 12:32 AM
Arithmetic overflow error converting numeric to data type numeric. darrel ASP .Net 4 07-19-2007 09:57 PM
Unable get Boolean and Numeric values from XLS into Dataset and Datagrid vighnesh ASP .Net 3 08-04-2005 02:16 PM
check if string contains numeric, and check string length of numeric value ief@specialfruit.be C++ 5 06-30-2005 01:08 PM
Problem exporting datagrid with numeric values to Excel =?Utf-8?B?TmFuY3lB?= ASP .Net 1 04-16-2005 02:36 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57