Barry
Fri Jun 30 21:38:13 CDT 2006
"Larry Smith" <no_spam@_nospam.com> wrote:
Did you include enough groups in the posting list? Gee :)
This is probably most appropriate for framework.windowsforms. It
certainly isn't related to .clr or .csharp, but most stuff in .csharp
isn't strictly related to C# either.
> Looking at the ".resx" files produced by the Windows forms designer, I see
> nodes like this:
>
> <data name="MyRadioBtn.Size" type="System.Drawing.Size, System.Drawing">
> <value>94, 21</value>
>
> If you then read the "94, 21" back into your code as a string (exactly as
> seen), how do you then deserialize it so it can be converted back into a
> "System.Drawing.Size" object (i.e.,there's no "System.Drawing.Size"
> constructor that takes this string as an argument but in any case, I assume
> the correct way is to reverse the process that created this string in the
> first place). Any help would be appreciated. Thanks.
This is done with a TypeConverter. There's a TypeConverterAttribute on
the Point class, and it points to a PointTypeConverter class in
System.Drawing. It's got a ConvertFrom method which does this
transformation. You're supposed to use TypeDescriptor to access the
converter, i.e. with TypeDescriptor.GetConverter(typeof(Point)) etc.
-- Barry
--
http://barrkel.blogspot.com/