using System;
using System.Drawing;
using System.Windows.Forms;
class PaintEvent
{
publicstaticvoid Main()
{
Form form = new Form();
form.Text = "Paint Event";
form.Paint += new PaintEventHandler(MyPaintHandler);
Application.Run(form);
}
staticvoid MyPaintHandler(object objSender, PaintEventArgs pea)
{
Graphics graphics = pea.Graphics;
graphics.Clear(Color.Chocolate);
}
}