Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert html or rgb color to system.drawing.brush

I want to convert html color e.g #FFFFD2 or RGB 255,255,210 to its brush color equivalent. am doing this in the listbox_drawitem event. see the sample code am using, i got from internet, buts its not working.I want to paint the listitem background with this color, but the items background gets painted white

dim col as string = "#FFFFFF"
Dim myBrush as Brush = new SolidBrush(Color.FromARGB(Integer.Parse( col.Substring( 1 ), System.Globalization.NumberStyles.HexNumber ) ) )

can anybody help?

like image 896
Smith Avatar asked Mar 17 '11 09:03

Smith


1 Answers

You can use ColorTranslator.FromHtml() method. This method will return Color class.

Dim b as new SolidBrush(ColorTranslator.FromHtml("#FFFFD2"))
like image 94
Anuraj Avatar answered Oct 05 '22 23:10

Anuraj