private void Form1_Paint(object sender, PaintEventArgs e) { e.Graphics.Clear(Color.White); if (currentPolygon != null) { currentPolygon.Draw(e.Graphics); } polygonDoc.Draw(e.Graphics); Pen squarePen = new Pen(Color.Black, 2); squarePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; Pen linePen = new Pen(Color.Black, 1); linePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; if (drawSquare) { e.Graphics.DrawRectangle(squarePen, startPoint.X - 5, startPoint.Y - 5, 10, 10); } if (!startPoint.IsEmpty) { e.Graphics.DrawLine(linePen, previousPoint, currentPoint); } squarePen.Dispose(); linePen.Dispose(); }
private void Form1_Paint(object sender, PaintEventArgs e) { Pen pen = new Pen(Color.Black, 1); pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; if (p != null) { p.Draw(e.Graphics); } doc.Draw(e.Graphics); if (!START.IsEmpty && !end.IsEmpty) //Za da se vlechat liniite { e.Graphics.DrawLine(pen, start, end); } if (closed && !START.IsEmpty) //za kocka { e.Graphics.DrawRectangle(pen, START.X - 5, START.Y - 5, 10, 10); } }
private void Form1_Paint(object sender, PaintEventArgs e) { e.Graphics.Clear(Color.White); polygons.Draw(e.Graphics); }