Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert Color to Hex String
Message
From
22/03/2005 08:55:21
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00997937
Message ID:
00998058
Views:
20
Einar,
Shortening it a bit if you don't mind:
System.Drawing.Color.Blue.ToArgb().ToString("x").Substring(2)
PS:I love this method chaining feature.
Cetin

>Bill,
>A little bit of typing will get you the result you want:
>
>System.Drawing.Color myColor = System.Drawing.Color.Blue;
>System.String sColor = myColor.R.ToString("X2") + myColor.G.ToString("X2") + myColor.B.ToString("X2");
>MessageBox.Show(sColor);
>
>
>Hope this helps.
>
>Einar
>
>>This should be a no-brainer and I'm sure I can figure it out (eventually :-) ), but in the interest of expediency, what is the .NET syntax to convert a Color object color value to a hex string?
>>
>>E.g. Color.Blue would be "0000FF"
>>
>>Thanks,
>>Bill
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform