using System;
using System.Drawing;
using System.Windows.Forms;
namespace Draw
{
public class DrawingForm : Form
{
public DrawingForm() // contructor
{
//InitializeComponent
this.Text = "My drawings"; // title of window form
this.Size = new Size(600, 600); // size of window form
this.Paint += new PaintEventHandler(MyPainting); // install handler
}
private void MyPainting(object sender, PaintEventArgs e)
{
Graphics G = e.Graphics;
// Test some GDI+ drawing here: methods to draw from point to point
Pen redPen = new Pen(Color.Red,2);
Pen bluePen = new Pen(Color.Blue,4);
Pen blackPen = new Pen(Color.Black,6);
Point[] pnts = { new Point(50, 150), new Point(200, 350),
new Point(400, 200), new Point(350, 150),
new Point(450, 100), new Point(550, 400),
new Point(400, 300)};
G.DrawLines(redPen, pnts); // draw from point to point
G.DrawCurve(bluePen, pnts); // draw splines
G.DrawBeziers(blackPen, pnts); //needs 7 points
}
}
public class Program //main program
{
public static int Main()
{
Application.Run(new DrawingForm()); // run a form
return 0; // let the OS know everything is OK
}
}
}