private Graphics grap; private List<point> polygonP=new List<point>(); private void panel1_MouseDown(object sender, MouseEventArgs e) { x1 = e.X; y1 = e.Y; polygonP.Add(new Point(e.X, e.Y)); } private void panel1_MouseUp(object sender, MouseEventArgs e) { Graphics grap = panel1.CreateGraphics(); Pen mypen = new Pen(colour,linewidth); polygonP.Add(new Point(e.X,e.Y)); if(polygonP.Count>1) { grap.DrawLine(mypen,polygonP[polygonP.Count-2],polygonP[polygonP.Count-1]); } if (polygonP.Count > 2) ***** { grap.DrawLine(mypen, polygonP[polygonP.Count - 1], polygonP[0]); polygonP.Clear(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)