Friday, January 7, 2011

Convert string color name into Color

For example, user enters blue then the color should be Blue.
for that you can use this:
           Color _color = (Color)TypeDescriptor.GetConverter(typeof(Color)).ConvertFromString("Blue");
//now you can make use of this _color :

            richTextBox1.ForeColor = _color;

No comments:

Post a Comment