user1531040 user1531040 - 5 months ago 36
ASP.NET (C#) Question

How to convert Hexadecimal #FFFFFF to System.Drawing.Color


Possible Duplicate:

How to get Color from Hex color code using .NET?




I want to convert a string like
#FFFFFF
to
System.Drawing.Color
. How do you do that?

Answer Source
string hex = "#FFFFFF";
Color _color = System.Drawing.ColorTranslator.FromHtml(hex);

Note: the hash is important!