Beispiel #1
0
        /// <summary>
        /// Try Parse : a same parsing fonction but
        /// do not raise an exception : return true if succeeded; the color result is a param out
        /// </summary>
        /// <param name="s">color value string</param>
        /// <param name="c">color solution</param>
        /// <returns>true if succeeded</returns>
        public static bool TryParse(string s, out CSSColor c)
        {
            bool res = false;

            try
            {
                c   = CSSColor.ParseColor(s);
                res = true;
            }
            catch
            {
                c = null;
            }
            return(res);
        }
Beispiel #2
0
 /// <summary>
 /// Constructor with a string representation of a color
 /// </summary>
 /// <param name="colorStr">color</param>
 public CSSColor(string colorStr)
 {
     this.Set(colorName, CSSColor.ParseColor(colorStr).Color);
 }