开发者

convert html or rgb color to system.drawing.brush

开发者 https://www.devze.com 2023-02-17 04:24 出处:网络
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

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 an开发者_Python百科ybody help?


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

Dim b as new SolidBrush(ColorTranslator.FromHtml("#FFFFD2"))
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号