示例#1
0
        protected override void OnBackColorChanged(EventArgs e)
        {
            DarkColor  = ColorSettings.ChangeBrightness(-20, this.BackColor);
            LightColor = ColorSettings.ChangeBrightness(-10, this.BackColor);

            DarkPen  = new Pen(new SolidBrush(DarkColor));
            LightPen = new Pen(new SolidBrush(LightColor));
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            Pen pen         = new Pen(new SolidBrush(TopColor), 1);
            int height_Up   = Depth - 1;
            int height_Down = Height - Depth;

            float opacityStep = 1f / depth;

            for (int i = 0; i < Depth; i++)
            {
                // оба варианта хороши по своему
                pen.Color = ColorSettings.ComputeOpacityColor(BackColor, TopColor, opacityStep * (i + 1));
                pen.Color = ColorSettings.ChangeBrightness(-3 * i, TopColor);

                e.Graphics.DrawLine(pen, 0, height_Up, Width, height_Up);
                e.Graphics.DrawLine(pen, 0, height_Down, Width, height_Down);
                height_Up--;
                height_Down++;
            }
        }