Exemple #1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            var borderThing = new Rectangle(0, 8, Width - 8, Height - 16);

            HSL half = Color;

            half.Luminance = 0.5f;
            ColorSpaceRenderer.GenerateColorSlider(e.Graphics, ColorSpaceHelper.HSLtoRGB(half).ToColor(), borderThing);

            ControlPaint.DrawBorder3D(e.Graphics, borderThing, Border3DStyle.SunkenOuter);

            float inc = (Height - 18) / 240.0f;

            float invLum = (240 - _curLum);

            e.Graphics.FillPolygon(Brushes.Black,
                                   new[]
            {
                new Point(Width - 7, 6 + (int)(invLum * inc) + 2),
                new Point(Width - 1, 12 + (int)(invLum * inc) + 2),
                new Point(Width - 1, 0 + (int)(invLum * inc) + 2),
            }
                                   );
        }
Exemple #2
0
        private void numericUpDown3_ValueChanged(object sender, EventArgs e)
        {
            if (_skipSet)
            {
                return;
            }

            saturationSlider1.CurrentLum = (int)numericUpDown3.Value;
            saturationSlider1.Color      = new HSL(colorSquare1.CurrentHue, (double)colorSquare1.CurrentSat / 240.0f, 0);
            panel1.BackColor             = ColorSpaceHelper.HSLtoRGB(MyHSL).ToColor();
        }
Exemple #3
0
        private void saturationSlider1_LumChanged(object sender, EventArgs e)
        {
            if (_skipSet)
            {
                return;
            }

            _skipSet             = true;
            numericUpDown3.Value = saturationSlider1.CurrentLum;

            panel1.BackColor = ColorSpaceHelper.HSLtoRGB(MyHSL).ToColor();
            SetColors();
            _skipSet = false;
        }
Exemple #4
0
        private void colorSquare1_SatChanged(object sender, EventArgs e)
        {
            if (_skipSet)
            {
                return;
            }

            _skipSet             = true;
            numericUpDown2.Value = colorSquare1.CurrentSat;

            saturationSlider1.Color = new HSL(colorSquare1.CurrentHue, (double)colorSquare1.CurrentSat / 240.0f, 0);
            panel1.BackColor        = ColorSpaceHelper.HSLtoRGB(MyHSL).ToColor();
            SetColors();
            _skipSet = false;
        }
Exemple #5
0
 private void ColorPicker_Load(object sender, EventArgs e)
 {
     panel1.BackColor        = ColorSpaceHelper.HSLtoRGB(MyHSL).ToColor();
     saturationSlider1.Color = new HSL(colorSquare1.CurrentHue, (double)colorSquare1.CurrentSat / 240.0f, 0);
     SetColors();
 }