I have color coming in the below way
{ Name=ffff8c00, ARGB=(255, 255, 140, 0) }
can i chekc the color name? Whether it is red or green..i wanted the name of color..
Is it possible to find ?
You can get the name from KnownColor. Try like below
string name = "Unknown";
foreach (KnownColor kc in Enum.GetValues(typeof(KnownColor)))
{
Color known = Color.FromKnownColor(kc);
if (Color.FromArgb(255,255,140,0).ToArgb() == known.ToArgb())
{
label1.Text = known.Name;
break;
}
}
Here I just hard code your value and return the name in label named 'label1'.
Check this thread http://social.msdn.microsoft.com/Forums/vstudio/en-US/3c80583e-d0a9-45e9-842a-bd7258f1fd2f/get-color-name-in-c?forum=csharpgeneral
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With