首页 > 代码库 > 渐变色背景

渐变色背景

1、实现渐变色背景

 1  private void Form1_Paint(object sender, PaintEventArgs e) 2         { 3             Paint_Background(this.Left,this.Width,this.Height, e); 4         } 5  6         private void Paint_Background(int Left, int Width, int Height, PaintEventArgs e) 7         { 8             Rectangle r = new Rectangle(Left, 0, Width, Height); 9             System.Drawing.Drawing2D.LinearGradientBrush brush =10                 new System.Drawing.Drawing2D.LinearGradientBrush(11                     r, 12                     Color.FromArgb(175, 210, 255),                                //颜色113                     Color.White,                                                  //颜色214                     System.Drawing.Drawing2D.LinearGradientMode.Vertical);15             e.Graphics.FillRectangle(brush, e.ClipRectangle);16         }

 

渐变色背景