Enumeration conversion
Date: 05/22/06
(C Sharp) Keywords: xml
I'm trying to utilize the System.Drawing.Drawing2D.HatchStyle enumeration in order to define a Brush type. The thing is, I need this to be dynamic in that I want to be able to change the HatchStyle changing a value in an XML file.
The XML looks somewhat like this:
System.Drawing.Drawing2D.HatchStyle.Weave
Anyway, I get the HatchStyle node but I can't get it to explicitly convert to the right type.
This is how I thought it would work:
System.Drawing.Drawing2D.HatchStyle objHatchStyle = (System.Drawing.Drawing2D.HatchStyle)Stylenode.InnerText;
but the line fails stating that it can't convert from type string to type HatchStyle.
Any ideas?
Source: http://community.livejournal.com/csharp/62496.html