Handle the Paint event for your control or form.
private void Form1_Paint( object sender, PaintEventArgs e )
{
Graphics g = e.Graphics;
Pen pen = new Pen( Color.White, 2 );
SolidBrush redBrush = new SolidBrush( Color.Red );
g.DrawEllipse( pen, 100, 150, 100, 100 );
g.DrawString( "Circle", Font, redBrush, 80, 150 );
g.FillRectangle( redBrush, 140, 35, 20, 40 );
g.DrawString( "Rectangle", Font, redBrush, 80, 50 );
g.DrawLine( pen, 114, 110, 150, 110 );
g.DrawString( "Line", Font, redBrush, 80, 104 );
}
Contributed from George Shepherd's Windows Forms FAQ