protected override void OnPaint(PaintEventArgs pe) { }
Graphics g = pe.Graphics;
Pen MyPen = new Pen(Color.Red);
Point a = new Point(50, 50); Point b = new Point(250, 250); g.DrawLine(MyPen, a, b);
using System; using System.Windows.Forms; using System.Drawing; class myForm : Form { public myForm() { this.Text = "GDI Example"; } protected override void OnPaint(PaintEventArgs pe) { Graphics g = pe.Graphics ; Pen MyPen = new Pen(Color.Red); Point a = new Point(50, 50); Point b = new Point(250, 250); g.DrawLine(MyPen, a, b); } public static void Main() { Application.Run(new myForm()); } }
csc /t:winexe /r:System.Windows.Forms.dll /r:System.Drawing.dll gdi.cs
Build Your Own ASP.NET Website Using C# & VB.NET