public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value is string)
{
string[] coords = ((string)value).Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
if (coords.Length != 4)
{
throw new SvgException("The 'viewBox' attribute must be in the format 'minX, minY, width, height'.");
}
return new SvgViewBox(float.Parse(coords[0], NumberStyles.Float, CultureInfo.InvariantCulture),
float.Parse(coords[1], NumberStyles.Float, CultureInfo.InvariantCulture),
float.Parse(coords[2], NumberStyles.Float, CultureInfo.InvariantCulture),
float.Parse(coords[3], NumberStyles.Float, CultureInfo.InvariantCulture));
}
return base.ConvertFrom(context, culture, value);
}