convert html or rgb color to system.drawing.brush

12,508

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

Dim b as new SolidBrush(ColorTranslator.FromHtml("#FFFFD2"))
Share:
12,508
Smith
Author by

Smith

Am a software and website developer, i design graphics and icons too!. I love programming, although i only consider myself an intermediate programmer. Hobbies I do alot of googling and ask alot of questions. I love watching movies (Not violent), listening to music (soft, blues etc), reading Others Am very good with my hands (meaning i like to do constructive work with them). If you have a programming problem, pls don't hesitate to ask me for help, i will do the best i can. May you have peace!

Updated on June 11, 2022

Comments

  • Smith
    Smith almost 2 years

    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?