creating color object

  • Thread starter Thread starter fragget
  • Start date Start date
F

fragget

hi

i have a string like "ffff032d" which represents
a color.

i want to create a color object given this value
but am having trouble.

this is what i have so far.

Color myColor = Color.FromArgb(Convert.ToInt32
("ffff032d"));

it fails to convert the string to an int.


thx - fg
 
fg,

When converting the string, you should be able to do the following:

// Get the color.
Color myColor = Color.FromArgb(Convert.ToInt32("fffff032d", 16));

The ToInt32 method allows you to specify the base that you want to
interpret the string in.

Hope this helps.
 
Back
Top