예제 #1
0
        public static Color FromHtml(string htmlColor)
        {
            if ((htmlColor == null) || (htmlColor.Length == 0))
            {
                return(Color.Transparent);
            }

            switch (htmlColor.ToLowerInvariant())
            {
            case "lightgrey":
                return(Color.LightGray);
            }

            var _conv = new ColorConverter();

            return(ColorConverter.StaticConvertFromString(null, htmlColor, null));
            //TypeConverter converter = TypeDescriptor.GetConverter (typeof (Color));
            //return (Color)converter.ConvertFromString(htmlColor);
        }