Give Mixed Color(gradient) for Windows Form Background

  1. protected override void OnPaintBackground(PaintEventArgs e)  
  2. {  
  3.     Rectangle r = this.ClientRectangle;  
  4.     if (r.Width > 0 && r.Height > 0)  
  5.     {  
  6.         using(LinearGradientBrush brush = new LinearGradientBrush(this.ClientRectangle, Color.MintCream, Color.DodgerBlue, 90 F))  
  7.         {  
  8.             e.Graphics.FillRectangle(brush, this.ClientRectangle);  
  9.         }  
  10.     }  
  11. }