开发者

how to color form Gradually from yellow to green

how to color form on winform us开发者_Go百科ing C# Gradually from yellow to green ?

thanks for any help


Example:

using System.Drawing;
using System.Drawing.Drawing2D;

public Form1() {
  InitializeComponent();
  this.DoubleBuffered = true;
  this.ResizeRedraw = true;
}

protected override void OnPaintBackground(PaintEventArgs e) {
  using (var lgb = new LinearGradientBrush(this.ClientRectangle, Color.Yellow, Color.Green, LinearGradientMode.Vertical))
    e.Graphics.FillRectangle(lgb, this.ClientRectangle);
}


You can implement the draw event of the form. Make sure you double buffer to reduce flashing. Then draw a rectangle with a LinearGradientBrush.

This should get you started.

http://weblogs.asp.net/cfrazier/archive/2005/08/10/422179.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜