I am creating a WinForms application and I use certain colors for most controls. I sometimes do this from the WinForms constructor, and sometimes directly into my code.
I have a static class that looks like this:
public static class MyColors
{
public static Color DarkGreen = Color.FromArgb(0, 70, 62);
...
public static Color Orange = Color.FromArgb(239, 132, 16);
}
I can easily use these colors in my code, but this cannot be done from the constructor, which causes this error:
MyColors.DarkGreen invalid value for Int32.
(I tried to keep the Int32 representation of these colors, but this is not with the same error)
, , rgb , MyColors , , Visual Studio. , .
?
. , , "KnownColors".