I'm building a WinForms application, and I'm using specific colors on most controls. I do that sometimes from the WinForms designer, and sometimes directly into my code.
I got a static class somewhere looking like that :
public static class MyColors
{
public static Color DarkGreen = Color.FromArgb(0, 70, 62);
...
public static Color Orange = Color.FromArgb(239, 132, 16);
}
I can use those colors in my code quite easily, but it's impossible to do from the designer, which raises this error :
MyColors.DarkGreen is not a valid value for Int32.
(I've tried to store the Int32 representation of those colors, but this fails with the same error)
The solution I'm using right now is to use the rgb color code in the designer, the MyColors class values in my code, and I'm doing changes using the replace all functionality of Visual Studio. This isn't a nice solution, but I haven't been able to find a better idea so far.
Any ideas ?
Note : I know about this question, which is slightly different from mine, as I'm not looking at changing the "KnownColors".