using System;
using System.Windows.Forms;
using System.Drawing;
public class HelloWorld : System.Windows.Forms.Form
{ // our Form class
public HelloWorld() // the constructor
{
this.Text = "Two Paint Handlers"; // Set this form’s Text Property
this.BackColor = Color.White;
this.Paint += new PaintEventHandler(MyPaintHandler1);
this.Paint += new PaintEventHandler(MyPaintHandler2);
}
static void Main() // Application’s entry point
{
Application.Run(new HelloWorld()); // Run the form
}
private void MyPaintHandler1(object objSender, PaintEventArgs pea)
{
Graphics g = pea.Graphics;
g.DrawString("First Paint Event Handler", this.Font, Brushes.Black, 10, 10);
}
private void MyPaintHandler2(object objSender, PaintEventArgs pea)
{
Graphics g = pea.Graphics;
g.DrawString("Second Paint Event Handler", this.Font, Brushes.Red, 10, 100);
}
}