Converting the HTML color code to RGB.

Posted by Puneet20884 under C# category on | Views : 3454
Sometimes we need to pass the color to the Graphics Objects and we have the color code from the HTML code like the one : #fcf9ed
And we need to give this color to brush object of graphics like :

SolidBrush brushForImage = new SolidBrush(....... color code here .......);

use the code below :

  string xCol = "#fcf9ed";
Color c = System.Drawing.ColorTranslator.FromHtml(xCol);

Comments or Responses

Login to post response