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
精彩评论