471,357 Members | 1,145 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,357 software developers and data experts.

knowcolor enumeration

When I use the following C# code:

string [] colorNames = Enum.GetNames(typeof(KnownColor));

colorNames does not contain the full list of member names detailed in the
System.Drawing.KnownColor enumeration, but just a subset. Why is this?

Paul.

Jul 21 '05 #1
2 2418
>colorNames does not contain the full list of member names detailed in the
System.Drawing.KnownColor enumeration, but just a subset. Why is this?


It does here. Which ones are missing? It's not the fact that the list
of names ins't sorted that's confusing you, is it?

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jul 21 '05 #2
Yes you are right. I was running an example program from the book 'Visual
C#.NET core reference' by Mickey Williams. The example used an up/down
control to cylcle through the KnownColor enumeration, setting the form's
background colour to each of the members. However, upon reaching the
'Transparent' member an exception was generated, as this is not a valid
background colour. I mistakenly assumed that the enumeration would be in the
same order as that specified in the MSDN library. As you pointed out, it is
not.

Thank you.

"Mattias Sjögren" wrote:
colorNames does not contain the full list of member names detailed in the
System.Drawing.KnownColor enumeration, but just a subset. Why is this?


It does here. Which ones are missing? It's not the fact that the list
of names ins't sorted that's confusing you, is it?

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Justin Wright | last post: by
8 posts views Thread by aevans1108 | last post: by
2 posts views Thread by Mark | last post: by
4 posts views Thread by Marshal | last post: by
2 posts views Thread by PaulUK | last post: by
1 post views Thread by Stefano G. | last post: by
3 posts views Thread by Davidoff | last post: by
reply views Thread by news.emn.fr | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.