Beispiel #1
0
        private void ResetMarker()
        {
            switch (colorMode)
            {
            case ColorModes.Hue:
                markerPoint.X = ColorProvider.Round((this.Width - 4) * colorHSL.S);
                markerPoint.Y = ColorProvider.Round((this.Height - 4) * (1.0 - colorHSL.L));
                break;

            case ColorModes.Saturation:
                markerPoint.X = ColorProvider.Round((this.Width - 4) * colorHSL.H);
                markerPoint.Y = ColorProvider.Round((this.Height - 4) * (1.0 - colorHSL.L));
                break;

            case ColorModes.Luminance:
                markerPoint.X = ColorProvider.Round((this.Width - 4) * colorHSL.H);
                markerPoint.Y = ColorProvider.Round((this.Height - 4) * (1.0 - colorHSL.S));
                break;

            case ColorModes.Red:
                markerPoint.X = ColorProvider.Round((this.Width - 4) * (double)colorRGB.B / 255);
                markerPoint.Y = ColorProvider.Round((this.Height - 4) * (1.0 - ((double)colorRGB.G / 255)));
                break;

            case ColorModes.Green:
                markerPoint.X = ColorProvider.Round((this.Width - 4) * (double)colorRGB.B / 255);
                markerPoint.Y = ColorProvider.Round((this.Height - 4) * (1.0 - ((double)colorRGB.R / 255)));
                break;

            case ColorModes.Blue:
                markerPoint.X = ColorProvider.Round((this.Width - 4) * (double)colorRGB.R / 255);
                markerPoint.Y = ColorProvider.Round((this.Height - 4) * (1.0 - ((double)colorRGB.G / 255)));
                break;
            }
        }
        private void ResetSlider()
        {
            double num = 0.0;

            switch (this.ColorMode)
            {
            case ColorModes.Red:
                num = (double)this.colorRGB.R / (double)byte.MaxValue;
                break;

            case ColorModes.Green:
                num = (double)this.colorRGB.G / (double)byte.MaxValue;
                break;

            case ColorModes.Blue:
                num = (double)this.colorRGB.B / (double)byte.MaxValue;
                break;

            case ColorModes.Hue:
                num = this.colorHSL.H;
                break;

            case ColorModes.Saturation:
                num = this.colorHSL.S;
                break;

            case ColorModes.Luminance:
                num = this.colorHSL.L;
                break;
            }
            this.position = this.Height - 8 - ColorProvider.Round((double)(this.Height - 8) * num);
        }
Beispiel #3
0
        private void ResetMarker()
        {
            switch (this.colorMode)
            {
            case ColorModes.Red:
                this.markerPoint.X = ColorProvider.Round((double)(this.Width - 4) * (double)this.colorRGB.B / (double)byte.MaxValue);
                this.markerPoint.Y = ColorProvider.Round((double)(this.Height - 4) * (1.0 - (double)this.colorRGB.G / (double)byte.MaxValue));
                break;

            case ColorModes.Green:
                this.markerPoint.X = ColorProvider.Round((double)(this.Width - 4) * (double)this.colorRGB.B / (double)byte.MaxValue);
                this.markerPoint.Y = ColorProvider.Round((double)(this.Height - 4) * (1.0 - (double)this.colorRGB.R / (double)byte.MaxValue));
                break;

            case ColorModes.Blue:
                this.markerPoint.X = ColorProvider.Round((double)(this.Width - 4) * (double)this.colorRGB.R / (double)byte.MaxValue);
                this.markerPoint.Y = ColorProvider.Round((double)(this.Height - 4) * (1.0 - (double)this.colorRGB.G / (double)byte.MaxValue));
                break;

            case ColorModes.Hue:
                this.markerPoint.X = ColorProvider.Round((double)(this.Width - 4) * this.colorHSL.S);
                this.markerPoint.Y = ColorProvider.Round((double)(this.Height - 4) * (1.0 - this.colorHSL.L));
                break;

            case ColorModes.Saturation:
                this.markerPoint.X = ColorProvider.Round((double)(this.Width - 4) * this.colorHSL.H);
                this.markerPoint.Y = ColorProvider.Round((double)(this.Height - 4) * (1.0 - this.colorHSL.L));
                break;

            case ColorModes.Luminance:
                this.markerPoint.X = ColorProvider.Round((double)(this.Width - 4) * this.colorHSL.H);
                this.markerPoint.Y = ColorProvider.Round((double)(this.Height - 4) * (1.0 - this.colorHSL.S));
                break;
            }
        }
Beispiel #4
0
 public void WriteXml(Stream stream)
 {
     using (XmlTextWriter xmlTextWriter = new XmlTextWriter(stream, Encoding.UTF8))
     {
         xmlTextWriter.Formatting = Formatting.Indented;
         xmlTextWriter.WriteStartElement("table");
         if (this.CellSpacing != 0)
         {
             xmlTextWriter.WriteAttributeString("cellspacing", this.CellSpacing.ToString());
         }
         if (this.CellPadding != 0)
         {
             xmlTextWriter.WriteAttributeString("cellpadding", this.CellPadding.ToString());
         }
         if (this.CellPadding != 1)
         {
             xmlTextWriter.WriteAttributeString("border", this.Border.ToString());
         }
         foreach (RowDefinition row in (Collection <RowDefinition>) this.rows)
         {
             xmlTextWriter.WriteStartElement("tr");
             if (row.BackColor != Color.Empty)
             {
                 xmlTextWriter.WriteAttributeString("bgcolor", "#" + ColorProvider.ColorToHex(row.BackColor));
             }
             bool flag = false;
             foreach (CellDefinition cell in (Collection <CellDefinition>)row.Cells)
             {
                 xmlTextWriter.WriteStartElement("td");
                 if (cell.ColSpan != 1)
                 {
                     xmlTextWriter.WriteAttributeString("colspan", cell.ColSpan.ToString());
                 }
                 if (cell.RowSpan != 1)
                 {
                     xmlTextWriter.WriteAttributeString("rowspan", cell.RowSpan.ToString());
                 }
                 if (cell.Border != -1)
                 {
                     xmlTextWriter.WriteAttributeString("border", cell.Border.ToString());
                 }
                 xmlTextWriter.WriteAttributeString("width", cell.Width.ToString());
                 if (!flag && row.Height != 20)
                 {
                     flag = true;
                     xmlTextWriter.WriteAttributeString("height", row.Height.ToString());
                 }
                 if (cell.BackColor != Color.Empty)
                 {
                     xmlTextWriter.WriteAttributeString("bgcolor", "#" + ColorProvider.ColorToHex(cell.BackColor));
                 }
                 xmlTextWriter.WriteString(cell.UniqueName);
                 xmlTextWriter.WriteEndElement();
             }
             xmlTextWriter.WriteEndElement();
         }
         xmlTextWriter.WriteEndElement();
     }
 }
Beispiel #5
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            HslColor hsl = HslColor.FromAhsl(255);

            switch (this.ColorMode)
            {
            case ColorModes.Hue:
                hsl.L = hsl.S = 1.0;
                break;

            case ColorModes.Saturation:
                hsl.H = this.ColorHSL.H;
                hsl.L = this.ColorHSL.L;
                break;

            case ColorModes.Luminance:
                hsl.H = this.ColorHSL.H;
                hsl.S = this.ColorHSL.S;
                break;
            }

            for (int i = 0; i < this.Height - 8; i++)
            {
                double step = 0;
                if (this.ColorMode < ColorModes.Hue)
                {
                    step = 255.0 - ColorProvider.Round(255.0 * (double)i / (this.Height - 8.0));
                }
                else
                {
                    step = 1.0 - ((double)i / (this.Height - 8));
                }

                Color color = Color.Empty;
                switch (this.ColorMode)
                {
                case ColorModes.Hue: hsl.H = step; color = hsl.RgbValue; break;

                case ColorModes.Saturation: hsl.S = step; color = hsl.RgbValue; break;

                case ColorModes.Luminance: hsl.L = step; color = hsl.RgbValue; break;

                case ColorModes.Red: color = Color.FromArgb((int)step, this.ColorRGB.G, this.ColorRGB.B); break;

                case ColorModes.Green: color = Color.FromArgb(this.ColorRGB.R, (int)step, this.ColorRGB.B); break;

                case ColorModes.Blue: color = Color.FromArgb(this.ColorRGB.R, this.ColorRGB.G, (int)step); break;
                }

                using (Pen pen = new Pen(color))
                    e.Graphics.DrawLine(pen, 11, i + 4, this.Width - 11, i + 4);
            }

            DrawSlider(e.Graphics);
        }
Beispiel #6
0
        private HslColor GetColor(int x, int y)
        {
            HslColor hsl = HslColor.FromAhsl(255);
            int      red, green, blue;

            switch (ColorMode)
            {
            case ColorModes.Hue:
                hsl.H = colorHSL.H;
                hsl.S = (double)x / (this.Width - 4);
                hsl.L = 1.0 - ((double)y / (this.Height - 4));
                break;

            case ColorModes.Saturation:
                hsl.S = colorHSL.S;
                hsl.H = (double)x / (this.Width - 4);
                hsl.L = 1.0 - ((double)y / (this.Height - 4));
                break;

            case ColorModes.Luminance:
                hsl.L = colorHSL.L;
                hsl.H = (double)x / (this.Width - 4);
                hsl.S = 1.0 - (double)y / (this.Height - 4);
                break;

            case ColorModes.Red:
                green = ColorProvider.Round(255 * (1.0 - (double)y / (this.Height - 4)));
                blue  = ColorProvider.Round(255 * (double)x / (this.Width - 4));
                hsl   = HslColor.FromColor(Color.FromArgb(colorRGB.R, green, blue));
                break;

            case ColorModes.Green:
                red  = ColorProvider.Round(255 * (1.0 - (double)y / (this.Height - 4)));
                blue = ColorProvider.Round(255 * (double)x / (this.Width - 4));
                hsl  = HslColor.FromColor(Color.FromArgb(red, colorRGB.G, blue));
                break;

            case ColorModes.Blue:
                red   = ColorProvider.Round(255 * (double)x / (this.Width - 4));
                green = ColorProvider.Round(255 * (1.0 - (double)y / (this.Height - 4)));
                hsl   = HslColor.FromColor(Color.FromArgb(red, green, colorRGB.B));
                break;
            }

            return(hsl);
        }
Beispiel #7
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);
        }
Beispiel #8
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));
        }
Beispiel #9
0
 private void colorDialog_ColorChanged(object sender, ColorChangedEventArgs args)
 {
     if (this.selectedHslColor.IsEmpty)
     {
         this.labelOldColor.BackColor = args.SelectedHslColor.RgbValue;
     }
     if (sender != this.professionalColorsControl)
     {
         this.professionalColorsControl.SetColorSilently(args.SelectedHslColor);
     }
     this.supressTextBoxColorChange = true;
     this.textBoxColor.Text         = ColorProvider.ColorToHex(args.SelectedColor);
     this.supressTextBoxColorChange = false;
     this.SetSelectedColor(args.SelectedColor);
     if (this.ColorChanged == null)
     {
         return;
     }
     this.ColorChanged((object)this, args);
 }
Beispiel #10
0
        private void ResetSlider()
        {
            double step = 0;

            switch (ColorMode)
            {
            case ColorModes.Hue: step = colorHSL.H; break;

            case ColorModes.Saturation: step = colorHSL.S; break;

            case ColorModes.Luminance: step = colorHSL.L; break;

            case ColorModes.Red: step = colorRGB.R / 255.0; break;

            case ColorModes.Green: step = colorRGB.G / 255.0; break;

            case ColorModes.Blue: step = colorRGB.B / 255.0; break;
            }

            position = this.Height - 8 - ColorProvider.Round((this.Height - 8) * step);
        }
Beispiel #11
0
        private HslColor GetColor(int x, int y)
        {
            HslColor hslColor = HslColor.FromAhsl((int)byte.MaxValue);

            switch (this.ColorMode)
            {
            case ColorModes.Red:
                hslColor = HslColor.FromColor(Color.FromArgb((int)this.colorRGB.R, ColorProvider.Round((double)byte.MaxValue * (1.0 - (double)y / (double)(this.Height - 4))), ColorProvider.Round((double)byte.MaxValue * (double)x / (double)(this.Width - 4))));
                break;

            case ColorModes.Green:
                hslColor = HslColor.FromColor(Color.FromArgb(ColorProvider.Round((double)byte.MaxValue * (1.0 - (double)y / (double)(this.Height - 4))), (int)this.colorRGB.G, ColorProvider.Round((double)byte.MaxValue * (double)x / (double)(this.Width - 4))));
                break;

            case ColorModes.Blue:
                hslColor = HslColor.FromColor(Color.FromArgb(ColorProvider.Round((double)byte.MaxValue * (double)x / (double)(this.Width - 4)), ColorProvider.Round((double)byte.MaxValue * (1.0 - (double)y / (double)(this.Height - 4))), (int)this.colorRGB.B));
                break;

            case ColorModes.Hue:
                hslColor.H = this.colorHSL.H;
                hslColor.S = (double)x / (double)(this.Width - 4);
                hslColor.L = 1.0 - (double)y / (double)(this.Height - 4);
                break;

            case ColorModes.Saturation:
                hslColor.S = this.colorHSL.S;
                hslColor.H = (double)x / (double)(this.Width - 4);
                hslColor.L = 1.0 - (double)y / (double)(this.Height - 4);
                break;

            case ColorModes.Luminance:
                hslColor.L = this.colorHSL.L;
                hslColor.H = (double)x / (double)(this.Width - 4);
                hslColor.S = 1.0 - (double)y / (double)(this.Height - 4);
                break;
            }
            return(hslColor);
        }
Beispiel #12
0
        private void ResetHSLRGB()
        {
            setHueSilently = true;
            switch (ColorMode)
            {
            case ColorModes.Hue:
                colorHSL.H = 1.0 - ((double)position / (this.Height - 9));
                ColorRGB   = ColorHSL.RgbValue;
                break;

            case ColorModes.Saturation:
                colorHSL.S = 1.0 - ((double)position / (this.Height - 9));
                ColorRGB   = ColorHSL.RgbValue;
                break;

            case ColorModes.Luminance:
                colorHSL.L = 1.0 - ((double)position / (this.Height - 9));
                ColorRGB   = ColorHSL.RgbValue;
                break;

            case ColorModes.Red:
                ColorRGB = Color.FromArgb(255 - ColorProvider.Round(255 * (double)position / (this.Height - 9)), ColorRGB.G, ColorRGB.B);
                ColorHSL = HslColor.FromColor(ColorRGB);
                break;

            case ColorModes.Green:
                ColorRGB = Color.FromArgb(ColorRGB.R, 255 - ColorProvider.Round(255 * (double)position / (this.Height - 9)), ColorRGB.B);
                ColorHSL = HslColor.FromColor(ColorRGB);
                break;

            case ColorModes.Blue:
                ColorRGB = Color.FromArgb(ColorRGB.R, ColorRGB.G, 255 - ColorProvider.Round(255 * (double)position / (this.Height - 9)));
                ColorHSL = HslColor.FromColor(ColorRGB);
                break;
            }
            setHueSilently = false;
        }
        private void ResetHSLRGB()
        {
            this.setHueSilently = true;
            switch (this.ColorMode)
            {
            case ColorModes.Red:
                this.ColorRGB = Color.FromArgb((int)byte.MaxValue - ColorProvider.Round((double)byte.MaxValue * (double)this.position / (double)(this.Height - 9)), (int)this.ColorRGB.G, (int)this.ColorRGB.B);
                this.ColorHSL = HslColor.FromColor(this.ColorRGB);
                break;

            case ColorModes.Green:
                this.ColorRGB = Color.FromArgb((int)this.ColorRGB.R, (int)byte.MaxValue - ColorProvider.Round((double)byte.MaxValue * (double)this.position / (double)(this.Height - 9)), (int)this.ColorRGB.B);
                this.ColorHSL = HslColor.FromColor(this.ColorRGB);
                break;

            case ColorModes.Blue:
                this.ColorRGB = Color.FromArgb((int)this.ColorRGB.R, (int)this.ColorRGB.G, (int)byte.MaxValue - ColorProvider.Round((double)byte.MaxValue * (double)this.position / (double)(this.Height - 9)));
                this.ColorHSL = HslColor.FromColor(this.ColorRGB);
                break;

            case ColorModes.Hue:
                this.colorHSL.H = 1.0 - (double)this.position / (double)(this.Height - 9);
                this.ColorRGB   = this.ColorHSL.RgbValue;
                break;

            case ColorModes.Saturation:
                this.colorHSL.S = 1.0 - (double)this.position / (double)(this.Height - 9);
                this.ColorRGB   = this.ColorHSL.RgbValue;
                break;

            case ColorModes.Luminance:
                this.colorHSL.L = 1.0 - (double)this.position / (double)(this.Height - 9);
                this.ColorRGB   = this.ColorHSL.RgbValue;
                break;
            }
            this.setHueSilently = false;
        }
Beispiel #14
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            HslColor hslcolor1 = HslColor.FromAhsl(255);
            HslColor hslcolor2 = HslColor.FromAhsl(255);

            switch (this.ColorMode)
            {
            case ColorModes.Hue:
                hslcolor1.H = this.ColorHSL.H;
                hslcolor2.H = this.ColorHSL.H;
                hslcolor1.S = 0.0;
                hslcolor2.S = 1.0;
                break;

            case ColorModes.Saturation:
                hslcolor1.S = this.ColorHSL.S;
                hslcolor2.S = this.ColorHSL.S;
                hslcolor1.L = 1.0;
                hslcolor2.L = 0.0;
                break;

            case ColorModes.Luminance:
                hslcolor1.L = this.ColorHSL.L;
                hslcolor2.L = this.ColorHSL.L;
                hslcolor1.S = 1.0;
                hslcolor2.S = 0.0;
                break;
            }

            for (int i = 0; i < this.Height - 4; i++)
            {
                int   value  = ColorProvider.Round(255 - (255 * (double)i / (this.Height - 4)));
                Color color1 = Color.Empty;
                Color color2 = Color.Empty;

                switch (this.ColorMode)
                {
                case ColorModes.Red:
                    color1 = Color.FromArgb(this.ColorRGB.R, value, 0);
                    color2 = Color.FromArgb(this.ColorRGB.R, value, 255);
                    break;

                case ColorModes.Green:
                    color1 = Color.FromArgb(value, this.ColorRGB.G, 0);
                    color2 = Color.FromArgb(value, this.ColorRGB.G, 255);
                    break;

                case ColorModes.Blue:
                    color1 = Color.FromArgb(0, value, this.ColorRGB.B);
                    color2 = Color.FromArgb(255, value, this.ColorRGB.B);
                    break;

                case ColorModes.Hue:
                    hslcolor2.L = hslcolor1.L = 1.0 - (double)i / (this.Height - 4);
                    color1      = hslcolor1.RgbValue;
                    color2      = hslcolor2.RgbValue;
                    break;

                case ColorModes.Saturation:
                case ColorModes.Luminance:
                    hslcolor2.H = hslcolor1.H = (double)i / (this.Width - 4);
                    color1      = hslcolor1.RgbValue;
                    color2      = hslcolor2.RgbValue;
                    break;
                }

                Rectangle bounds1 = new Rectangle(2, 2, this.Width - 4, 1);
                Rectangle bounds2 = new Rectangle(2, i + 2, this.Width - 4, 1);

                if (ColorMode == ColorModes.Saturation || ColorMode == ColorModes.Luminance)
                {
                    bounds1 = new Rectangle(2, 2, 1, this.Height - 4);
                    bounds2 = new Rectangle(i + 2, 2, 1, this.Height - 4);

                    using (LinearGradientBrush brush = new LinearGradientBrush(bounds1, color1, color2, 90, false))
                        e.Graphics.FillRectangle(brush, bounds2);
                }
                else
                {
                    using (LinearGradientBrush brush = new LinearGradientBrush(bounds1, color1, color2, 0, false))
                        e.Graphics.FillRectangle(brush, bounds2);
                }
            }

            Pen pen = Pens.White;

            if (colorHSL.L >= (double)200 / 255)
            {
                if (colorHSL.H < (double)26 / 360 || colorHSL.H > (double)200 / 360)
                {
                    if (colorHSL.S <= (double)70 / 255)
                    {
                        pen = Pens.Black;
                    }
                }
                else
                {
                    pen = Pens.Black;
                }
            }

            e.Graphics.DrawEllipse(pen, markerPoint.X - 5, markerPoint.Y - 5, 10, 10);
        }
Beispiel #15
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            HslColor hslColor1 = HslColor.FromAhsl((int)byte.MaxValue);
            HslColor hslColor2 = HslColor.FromAhsl((int)byte.MaxValue);

            switch (this.ColorMode)
            {
            case ColorModes.Hue:
                hslColor1.H = this.ColorHSL.H;
                hslColor2.H = this.ColorHSL.H;
                hslColor1.S = 0.0;
                hslColor2.S = 1.0;
                break;

            case ColorModes.Saturation:
                hslColor1.S = this.ColorHSL.S;
                hslColor2.S = this.ColorHSL.S;
                hslColor1.L = 1.0;
                hslColor2.L = 0.0;
                break;

            case ColorModes.Luminance:
                hslColor1.L = this.ColorHSL.L;
                hslColor2.L = this.ColorHSL.L;
                hslColor1.S = 1.0;
                hslColor2.S = 0.0;
                break;
            }
            for (int index = 0; index < this.Height - 4; ++index)
            {
                int   num    = ColorProvider.Round((double)byte.MaxValue - (double)byte.MaxValue * (double)index / (double)(this.Height - 4));
                Color color1 = Color.Empty;
                Color color2 = Color.Empty;
                switch (this.ColorMode)
                {
                case ColorModes.Red:
                    color1 = Color.FromArgb((int)this.ColorRGB.R, num, 0);
                    color2 = Color.FromArgb((int)this.ColorRGB.R, num, (int)byte.MaxValue);
                    break;

                case ColorModes.Green:
                    color1 = Color.FromArgb(num, (int)this.ColorRGB.G, 0);
                    color2 = Color.FromArgb(num, (int)this.ColorRGB.G, (int)byte.MaxValue);
                    break;

                case ColorModes.Blue:
                    color1 = Color.FromArgb(0, num, (int)this.ColorRGB.B);
                    color2 = Color.FromArgb((int)byte.MaxValue, num, (int)this.ColorRGB.B);
                    break;

                case ColorModes.Hue:
                    hslColor2.L = hslColor1.L = 1.0 - (double)index / (double)(this.Height - 4);
                    color1      = hslColor1.RgbValue;
                    color2      = hslColor2.RgbValue;
                    break;

                case ColorModes.Saturation:
                case ColorModes.Luminance:
                    hslColor2.H = hslColor1.H = (double)index / (double)(this.Width - 4);
                    color1      = hslColor1.RgbValue;
                    color2      = hslColor2.RgbValue;
                    break;
                }
                Rectangle rect1 = new Rectangle(2, 2, this.Width - 4, 1);
                Rectangle rect2 = new Rectangle(2, index + 2, this.Width - 4, 1);
                if (this.ColorMode == ColorModes.Saturation || this.ColorMode == ColorModes.Luminance)
                {
                    rect1 = new Rectangle(2, 2, 1, this.Height - 4);
                    rect2 = new Rectangle(index + 2, 2, 1, this.Height - 4);
                    using (LinearGradientBrush linearGradientBrush = new LinearGradientBrush(rect1, color1, color2, 90f, false))
                        e.Graphics.FillRectangle((Brush)linearGradientBrush, rect2);
                }
                else
                {
                    using (LinearGradientBrush linearGradientBrush = new LinearGradientBrush(rect1, color1, color2, 0.0f, false))
                        e.Graphics.FillRectangle((Brush)linearGradientBrush, rect2);
                }
            }
            Pen pen = Pens.White;

            if (this.colorHSL.L >= 40.0 / 51.0)
            {
                if (this.colorHSL.H < 13.0 / 180.0 || this.colorHSL.H > 5.0 / 9.0)
                {
                    if (this.colorHSL.S <= 14.0 / 51.0)
                    {
                        pen = Pens.Black;
                    }
                }
                else
                {
                    pen = Pens.Black;
                }
            }
            e.Graphics.DrawEllipse(pen, this.markerPoint.X - 5, this.markerPoint.Y - 5, 10, 10);
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            HslColor hslColor = HslColor.FromAhsl((int)byte.MaxValue);

            switch (this.ColorMode)
            {
            case ColorModes.Hue:
                hslColor.L = hslColor.S = 1.0;
                break;

            case ColorModes.Saturation:
                hslColor.H = this.ColorHSL.H;
                hslColor.L = this.ColorHSL.L;
                break;

            case ColorModes.Luminance:
                hslColor.H = this.ColorHSL.H;
                hslColor.S = this.ColorHSL.S;
                break;
            }
            for (int index = 0; index < this.Height - 8; ++index)
            {
                double num   = this.ColorMode >= ColorModes.Hue ? 1.0 - (double)index / (double)(this.Height - 8) : (double)byte.MaxValue - (double)ColorProvider.Round((double)byte.MaxValue * (double)index / ((double)this.Height - 8.0));
                Color  color = Color.Empty;
                switch (this.ColorMode)
                {
                case ColorModes.Red:
                    color = Color.FromArgb((int)num, (int)this.ColorRGB.G, (int)this.ColorRGB.B);
                    break;

                case ColorModes.Green:
                    color = Color.FromArgb((int)this.ColorRGB.R, (int)num, (int)this.ColorRGB.B);
                    break;

                case ColorModes.Blue:
                    color = Color.FromArgb((int)this.ColorRGB.R, (int)this.ColorRGB.G, (int)num);
                    break;

                case ColorModes.Hue:
                    hslColor.H = num;
                    color      = hslColor.RgbValue;
                    break;

                case ColorModes.Saturation:
                    hslColor.S = num;
                    color      = hslColor.RgbValue;
                    break;

                case ColorModes.Luminance:
                    hslColor.L = num;
                    color      = hslColor.RgbValue;
                    break;
                }
                using (Pen pen = new Pen(color))
                    e.Graphics.DrawLine(pen, 11, index + 4, this.Width - 11, index + 4);
            }
            this.DrawSlider(e.Graphics);
        }