예제 #1
0
    private void picBD_Paint(object sender, PaintEventArgs e)
    {
        Graphics g     = e.Graphics;
        int      xstep = 12;
        int      x     = picBD.ClientRectangle.X;
        int      xx;

        for (int i = 0; i < xstep; i++)
        {
            xx = picBD.ClientRectangle.X + (int)((double)(i + 1) * (double)picBD.ClientRectangle.Width / (double)xstep);
            Color col;
            if (i < xstep / 2)
            {
                col = ColorUtil.BrightColor(color, (double)(xstep / 2 - 1 - i) / (double)(xstep / 2 - 1));
            }
            else
            {
                col = ColorUtil.DarkColor(color, (double)(i - (xstep / 2 - 1) - 1) / (double)(xstep / 2 - 1));
            }
            using (Brush br = new SolidBrush(col)) {
                g.FillRectangle(br, x, picBD.ClientRectangle.Y, xx - x, picBD.ClientRectangle.Height);
            }
            x = xx;
        }
    }