天涯一飘絮

导航

 
/// <summary>
02 /// 实现“背景色渐变”的功能。【尚不完善】
03 /// </summary>
04 /// <param name="e"></param>
05 protected override void OnPaintBackground(PaintEventArgs e)
06 {
07     int y, dy;
08     //y=this.Height-this.ClientRectangle.Height;
09     y = this.ClientRectangle.Location.Y;
10     dy = this.ClientRectangle.Height / 256;
11     for (int i = 255; i >= 0; i--)
12     {
13         
14         Color c = new Color();
15         c = Color.FromArgb(Convert.ToInt32(textBox1.Text.ToString()), i,Convert.ToInt32(textBox2.Text.ToString()));
16         SolidBrush sb = new SolidBrush(c);
17         Pen p = new Pen(sb, 100);
18         e.Graphics.DrawRectangle(p,this.ClientRectangle.X, y, this.Width,y+dy);
19         y = y + dy;
20     }
21 }
posted on 2010-12-05 22:43  冰云  阅读(476)  评论(0编辑  收藏  举报