I’ve searched the forum for a solution to what seems a simple question, but none of my searches yielded relevant answers.
I’d like to be able to create a color from a text string, but don’t see a good way to do this. For example, it would be great to have something like:
GeoColor.StandardColors.FromText(“AntiqueWhite”);
The need for this is that we want to save our associated style information for a given layer in a DB, including the colors. Any other ideas or suggestions on how to do this would be greatly appreciated.
-Ron
Create GeoColor.StandardColor From a text string
Hi Ron,
I wish this code can works for your requirement.
private GeoColor GetGeoColorFromName(string name)
{
Color tmpColor = Color.FromName(name);
GeoColor returnColor = new GeoColor(tmpColor.A, tmpColor.R, tmpColor.G, tmpColor.B);
return returnColor;
}
Regards,
Don
Thanks Don. That worked perfectly for my needs.
Hi Ron,
Any other questions, don’t hesitate to let us know.
Thanks,
Troy