Пример #1
0
        private void hueTB_Scroll(object sender, EventArgs e)
        {
            var original = pnlResultColor.BackColor;

            double hue;
            double saturation;
            double value;

            HsvCM.ColorToHsv(original, out hue, out saturation, out value);

            var copy = HsvCM.ColorFromHsv(hueTB.Value, saturation, value);

            pnlResultColor.BackColor = copy;

            ApplyFilter();
        }
Пример #2
0
        private void ShowColorDialogButtonClickEventHandler(object sender, EventArgs e)
        {
            using (var colorDlg = new ColorDialog())
            {
                colorDlg.AllowFullOpen = true;
                colorDlg.AnyColor      = true;
                colorDlg.FullOpen      = true;

                if (sender == btnSelectColorToReplace)
                {
                    colorDlg.Color = pnlSourceColor.BackColor;
                }
                else if (sender == btnSelectReplacementColor)
                {
                    colorDlg.Color = pnlResultColor.BackColor;
                }

                if (colorDlg.ShowDialog() == DialogResult.OK)
                {
                    if (sender == btnSelectColorToReplace)
                    {
                        pnlSourceColor.BackColor = colorDlg.Color;
                    }
                    else if (sender == btnSelectReplacementColor)
                    {
                        pnlResultColor.BackColor = colorDlg.Color;
                    }
                    double hue;
                    double saturation;
                    double value;
                    HsvCM.ColorToHsv(pnlResultColor.BackColor, out hue, out saturation, out value);
                    hueTB.Value = (int)hue;

                    ApplyFilter();
                }
            }
        }