Convert HTML color to System.Drawing.Color

Ok so I have an HTML color I need to use in an asp.net web app. Problem is most of the asp.net controls use System.Drawing.Color. So I can't just go

TextControl.BackColor = "FFFFFF";

or whatever you have to convert the HTML to a System.Drawing.Color like so:

TextControl.BackColor = System.Drawing.ColorTranslator.FromHtml("FFFFFF");

And voila! HTML colors are now System.Drawing.Colors

Comments

Popular posts from this blog

String.Replace vs Regex.Replace

C# Form Application in Kiosk Mode/Fullscreen

Javascript numeric only text box