Hallo everbody,
if for example I set the BackColor of a Panel in Winform using Visual Studio, I can pick up the color from 3 lists:
Custom, Web, System
Is it possible to retreive only the Web colors in my C# code application? They are part of KnownColor but so far I could only find how to eliminate System Control from my list.
I would like to use the web colors because they are sorted in a nice way and I would like to insert them into a self-implemented combobox.
Thank you
Colorstruct contains all the web colors as constants (system colors are defined as constants inSystemColorsclass)To get a list of these colors just do:
having
GetConstantsdefined as follow:EDIT:
To get colors sorted exactly like in VS do:
with
StandardColorComparerandSystemColorComparerdefined as follows:N.B. :
This code has been taken from
System.Drawing.Design.ColorEditorthrough reflector.