Look at Reflection and Type.InvokeMemb er:
more specifically, I think this will do it for you (although I haven't
tested it very thoroughly):
Type brushType = typeof(Brushes) ;
Brush myBrush = (Brush) brushType.Invok eMember("PeachP uff",
BindingFlags.Pu blic | BindingFlags.St atic| BindingFlags.Ge tProperty ,
null, null, new object [] {});
-mike
"Rene" <no****@nospam. com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
I would like to get a reference to a Brush using the color name of
the brush. For example, right now if I want a brush with a certain
color, I would hard code something like Brushes.PeachPu ff, this will get me a
PeachPuff brush, but what if my brush depended on a string passed by
the user? If all I had was a string with the name "PeachPuff" how can I
create Brushes.PeachPu ff using the string value?
Thank you.