Search This Blog

Wednesday, July 8, 2009

drawBackgound for a form in c#

private void drawBackgound()
{
Bitmap bmp = new Bitmap(this.Width, this.Height);
Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);
Graphics g = Graphics.FromImage(bmp);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.FillRectangle(new System.Drawing.Drawing2D.LinearGradientBrush(rect, Color.White, Color.FromArgb(203, 225, 252), 90), rect);

this.BackgroundImage = bmp;
}

No comments:

Post a Comment