2D Graphics C# Tutorial

using System;
using System.Drawing;
using System.Windows.Forms;
class PaintHello
{
     public static void Main()
     {
          Form form      = new Form();
          form.BackColor = Color.White;
          form.Paint    += new PaintEventHandler(MyPaintHandler);
   
          Application.Run(form);
     }
     static void MyPaintHandler(object objSender, PaintEventArgs pea)
     {
          Form     form = (Form)objSender;
          Graphics g = pea.Graphics;
   
          PointF pt = new PointF(50.0F, 50.0F);
          PointF newPoint = PointF.Empty;
          newPoint.X = 100.0F;
          newPoint.Y = 200.0F;
          Pen pn = new Pen(Color.Blue, 4);
          g.DrawLine(pn, pt, newPoint);
          pn.Dispose();
          g.Dispose();        
     }
}