Example #1
0
        public override object ConvertFromString(string value, IValueSerializerContext context)
        {
            Color c;

            if (Color.TryParse(value, out c))
            {
                return(c);
            }
            else
            {
                throw new InvalidOperationException("Could not parse color value: " + value);
            }
        }
Example #2
0
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            Color c;

            if (Color.TryParse((string)value, out c))
            {
                return(c);
            }
            else
            {
                throw new InvalidOperationException("Could not parse color value: " + value);
            }
        }