1,977
社区成员
![](https://csdnimg.cn/release/cmsfe/public/img/topic.427195d5.png)
![](https://csdnimg.cn/release/cmsfe/public/img/me.40a70ab0.png)
![](https://csdnimg.cn/release/cmsfe/public/img/task.87b52881.png)
![](https://csdnimg.cn/release/cmsfe/public/img/share-circle.3e0b7822.png)
using System;
using System.Drawing;
using System.Windows.Forms;
class Test
{
public delegate void PaintEventHandler(object objSend, PaintEventArgs pea);
public static void Main()
{
Form form=new Form();
form.Text="PaintEvent";
form.Paint += new PaintEventHandler(MyPaintEvent);
Application.Run(form);
MessageBox.Show("Application is return ","PaintEvent");
}
static void MyPaintEvent(object objSend, PaintEventArgs pea)
{
Graphics graphics=pea.Graphics;
graphics.Clear(Color.Chocolate);
}
}
form.Paint += new PaintEventHandler(MyPaintEvent);