Example #1
0
        private Color GetColorAttribute(string value, Color defaultValue)
        {
            Color color = Color.Empty;

            if (!string.IsNullOrEmpty(value))
            {
                color = ColorProvider.HexToColor(value);
                if (color == Color.Empty)
                {
                    color = Color.FromName(value);
                }
                if (color == Color.Empty)
                {
                    return(defaultValue);
                }
            }
            return(color);
        }
Example #2
0
        private void textBoxColor_TextChanged(object sender, EventArgs e)
        {
            if (this.supressTextBoxColorChange)
            {
                return;
            }
            Color color = ColorProvider.HexToColor(this.textBoxColor.Text);

            if (color == Color.Empty)
            {
                return;
            }
            this.SetSelectedColor(color);
            this.professionalColorsControl.SetColorSilently(HslColor.FromColor(color));
            if (this.ColorChanged == null)
            {
                return;
            }
            this.ColorChanged((object)this, new ColorChangedEventArgs(color));
        }