May 9, 2011

Very old stuff – convert System.Drawing.Color to HTML.

When I was with Delphi, I wrote utility to do this myself (I mean Delphi in its early days) as I wasn’t aware for built-in mechanism to achieve that.

Now with .NET there is utility to do this for you but I often forgot which class has static method to convert System.Drawing.Color to Html string.

Here it is:

System.Drawing.ColorTranslator.ToHtml(color)

I think wouldn’t it be smarter to have an extender attached to System.Drawing.Color to do this for me from now on … :).

No comments: