Example #1
0
        // Colorize : Picture
        private void pictureBoxColorize_Paint(object sender, PaintEventArgs e)
        {
            int    width     = pictureBoxColorize.Width;
            int    height    = pictureBoxColorize.Height;
            double increment = (double)width / 255.0;
            int    x         = 0;

            for (double i = 0; i < width; i += increment, x++)
            {
                Pen pen = new Pen(Do.HSLtoRGBColor(x / 255.0, (double)colorizeSaturation.Value / 255.0, 0.5));
                e.Graphics.DrawLine(pen, (float)i, 0, (float)i, height);
            }
            double ratio = (double)pictureBoxColorize.Width / 255.0;

            x = Math.Min(pictureBoxColorize.Width, Math.Max(0, (int)((double)colorizeHue.Value * ratio)));
            e.Graphics.DrawLine(new Pen(Color.Black), x, 0, x, height);
        }