public void Draw(Graphics g) { foreach (Polygon p in poligons) { p.Draw(g); } if (currentPolygon != null) { if (currentPolygon.Points.Count > 1) { currentPolygon.Draw(g); } } if (!firstPoint.IsEmpty) { Pen p = new Pen(Color.Black, 1); p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; g.DrawLine(p, currentPolygon.LastPoint, currentPoint); if (isHit) { g.DrawRectangle(p, firstPoint.X - 5, firstPoint.Y - 5, 10, 10); } p.Dispose(); } }
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) { e.Graphics.Clear(Color.White); if (Polygon != null) { Polygon.Draw(e.Graphics); } Scene.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(); }
public void Draw(Graphics g) { foreach (object obj in Polygons) { Polygon p = obj as Polygon; p.Draw(g); } }
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); } }