By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,052 Members | 1,456 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,052 IT Pros & Developers. It's quick & easy.

Color ComboBox Populating

P: n/a
I have a dropdown list, then right now I simply call

BGColorComboBox.DataSource =
BGColorComboBox.SelectedItem = KnownColor.Black;

Which works great except it has some values I don't want... Everything
in the "SystemColor" enumeration actually (IE "ActiveBorder"

Is there a easy/fast way to hide all the "SystemColor" enum values from
the ComboBox after it has all the "KnownColor"'s in it? Or easy way to
just make a new enum that is the "KnownColor" enum minus the
"SystemColor" enum?
Or... All the colors I want are public static members of the
"System.Drawing.Color" stuct... (IE "System.Drawing.Color.AquaBlue").
Can I populate the combo box with only the static members of the
"System.Drawing.Color" stuct easily/fast?

Or they have "SystemColor" "ConsoleColor" "KnownColor" enums... is
there a "WebColor" or "ActualColor" enum already created that I just
coudln't find?

Thanks NB

Oct 1 '06 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Found a way :)

List<objectALColor = new List<object>();
foreach(object clr in Enum.GetValues(typeof(KnownColor)))
if(!Color.FromKnownColor((KnownColor)clr).IsSystem Color)
BGColorComboBox.DataSource = ALColor;

Oct 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.