110,535
社区成员
发帖
与我相关
我的任务
分享
// Getting the graphics object
Graphics g = pevent.Graphics;
// Creating the rectangle for the gradient
Rectangle rBackground = new Rectangle(0, 0, this.Width, this.Height);
// Creating the lineargradient
System.Drawing.Drawing2D.LinearGradientBrush bBackground
= new System.Drawing.Drawing2D.LinearGradientBrush(rBackground, _Color1, _Color2, _ColorAngle);
// Draw the gradient onto the form
g.FillRectangle(bBackground, rBackground);
// Disposing of the resources held by the brush
bBackground.Dispose();