Convert string color name into Color

By Super Man

Here i will show how you can 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;

Convert string color name into Color  (1340 Views)