C# convert HTML/System.Drawing.Color

Many times I find myself having to use an HTML color that isn't defined in the System.Drawing.Color section of the framework. .Net gives you an easy way to get around this. Use the ColorTranslator.FromHtml static method in the System.Drawing namespace.

System.Drawing.Color c = System.Drawing.ColorTranslator.FromHtml("#F5F7F8");
String strHtmlColor = System.Drawing.ColorTranslator.ToHtml(c);


Popular posts from this blog

C# Form Application in Kiosk Mode/Fullscreen

C# using a transaction with ODBC

Notify Icon Text vs BalloonTipText