Пример #1
0
        public static Color ToColorT(object value)
        {
            if (value is Color)
            {
                return((Color)value);
            }

            if (value is int)
            {
                return(NColor.ColorFromUInt32(0xFF000000 | (uint)(int)value));
            }

            if (value is uint)
            {
                return(NColor.ColorFromUInt32((uint)value));
            }

            var s = value as string;

            if (s != null)
            {
                return(NColor.Parse(s));
            }

            throw new InvalidCastException();
        }