Mega Code Archive

 
Categories / C# Tutorial / 2D Graphics
 

Createing Point

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;               Point pt = new Point(50, 50);           Point newPoint = Point.Empty;           newPoint.X = 100;           newPoint.Y = 200;           Pen pn = new Pen(Color.Blue, 4);           g.DrawLine(pn, pt, newPoint);           pn.Dispose();           g.Dispose();      } }