private void gamutWarningColorButton_Click(object sender, EventArgs e)
        {
            using (ColorPickerForm form = new ColorPickerForm("Choose a gamut warning color:"))
            {
                form.BackColor = BackColor;
                form.ForeColor = ForeColor;

                form.SetDefaultColor(this.gamutWarningColorButton.Value);
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    this.gamutWarningColorButton.Value = form.UserPrimaryColor;
                    UpdateConfigToken();
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Shows the color picker dialog, with the specified initial color.
        /// </summary>
        /// <param name="prompt">The prompt.</param>
        /// <param name="red">The red component of the initial color.</param>
        /// <param name="green">The green component of the initial color.</param>
        /// <param name="blue">The blue component of the initial color.</param>
        /// <returns>The user's chosen color; or null if the user canceled the dialog.</returns>
        public static ColorBgra?ShowColorPickerDialog(string prompt, short red, short green, short blue)
        {
            ColorBgra?chosenColor = null;

            using (ColorPickerForm form = new ColorPickerForm(prompt))
            {
                form.BackColor = formBackColor;
                form.ForeColor = formForeColor;
                form.SetDefaultColor(red, green, blue);

                if (form.ShowDialog() == DialogResult.OK)
                {
                    chosenColor = form.UserPrimaryColor;
                }
            }

            return(chosenColor);
        }