Reputation: 71171
What is the best way to turn strings like "red", "green", "yellow", "aliceblue", etc... into the actual System.Drawing.Color value?
I was looking at reflection and something about that didn't seem right.
Upvotes: 18
Views: 33535
Reputation: 5422
System.Drawing.Color has a static method:
public static Color FromName(string name)
Use it like so:
Color c = Color.FromName("AliceBlue")
Upvotes: 24