namespace System.Drawing
{
- public class SizeFConverter : TypeConverter\r
- {\r
+ public class SizeFConverter : TypeConverter
+ {
public SizeFConverter ()
{
}
-\r
+
public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == typeof (string))
return base.CanConvertFrom (context, sourceType);
}
-\r
+
public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
{
if (destinationType == typeof (string))
return base.CanConvertTo (context, destinationType);
}
-\r
+
public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
{
string s = value as string;
return new SizeF (numSubs[0], numSubs[1]);
}
-\r
+
public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if ((destinationType == typeof (string)) && (value is SizeF))
return base.ConvertTo (context, culture, value, destinationType);
}
-\r
+
public override object CreateInstance (ITypeDescriptorContext context, IDictionary propertyValues)
{
float w = (float) propertyValues ["Width"];
float h = (float) propertyValues ["Height"];
return new SizeF (w, h);
}
-\r
+
public override bool GetCreateInstanceSupported (ITypeDescriptorContext context)
{
return true;
}
-\r
+
public override PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context, object value, Attribute[] attributes)
{
if (value is SizeF)
return base.GetProperties (context, value, attributes);
}
-\r
+
public override bool GetPropertiesSupported (ITypeDescriptorContext context)
{
return true;
- }\r
+ }
}
}