Pages

Thursday, August 27, 2009

Gradient Effect to Controls C# by Praveen P.R

// Code in C#

Give gradient effect to control at Paint Event

  private void Form1_Paint(object sender, PaintEventArgs e)
  {
  System.Drawing.Drawing2D.LinearGradientBrush gradBrush;
  Point start = new Point(-100,-100);
  Point end = new Point(Form1.Width-1000, Form1.Height+1300);
  gradBrush = new
  System.Drawing.Drawing2D.LinearGradientBrush(start, end, Color.Black, Color.Honeydew );
  Graphics g = Form1.CreateGraphics();
  g.FillRectangle(gradBrush, new Rectangle(0,0,Form1.Width, Form1.Height));
  }

No comments: