Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting a list of System.Drawing.Colors ?

Status
Not open for further replies.

StevenK

Programmer
Jan 5, 2001
1,294
GB
I'm after a simple method / means of obtaining a list of all the colors that can be prefixed with the code :
System.Drawing.Color.{something here}
The results would be a list of all the strings, i.e. 'Red', 'Yellow', 'Orange', etc.
I'm guessing this should be an easy hit but I can't see it for looking.
Any advice would be greatly appreciated.
Thanks
Steve
 
You can use reflection for this:
Code:
Type myType = typeof(System.Drawing.Color);
PropertyInfo[] myPropertyInfo = myType.GetProperties;
But be aware you'll get all the properties, not just the ones that are colors.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top