日期:2014-05-19  浏览次数:20788 次

如何在按钮的CLICK事件里面调用窗体的Paint事件?
private   void   panel27_Paint(object   sender,   System.Windows.Forms.PaintEventArgs   e)
{
Graphics   g   =   e.Graphics;
System.Drawing.Drawing2D.LinearGradientBrush   mybrush   =   new   System.Drawing.Drawing2D.LinearGradientBrush(this.panel27.ClientRectangle,this.color1,this.color2,System.Drawing.Drawing2D.LinearGradientMode.Vertical);
g.FillRectangle(mybrush,this.panel27.ClientRectangle);
}

我想在设置了color1和color2变量的值之后,在按钮的CLICK的事件里面调用Paint事件,重绘panel27.
问题是在按钮事件里面如何调用?

------解决方案--------------------
直接调用Form1.Refresh(),会自动重绘事件