protected override void OnMouseClick(MouseEventArgs e) { var x = Convert.ToInt32(Math.Floor(e.X/pixelDelta)); var y = Convert.ToInt32(Math.Floor(e.Y/pixelDelta)); var clickPoint = new Point(x, y); mousePoint = clickPoint; edgeFirstPoint = clickPoint; if (currentPolygon == null) currentPolygon = new Polygon(clickPoint, PanelColor.BackColor); else { currentPolygon.TryAddVertex(clickPoint); if (currentPolygon.Closed) { polygons.Add(currentPolygon); currentPolygon = null; edgeFirstPoint = null; currentEdge = null; } } Invalidate(); }
private void Reset() { colorGrid.Reset(); polygons.Clear(); currentEdge = null; currentPolygon = null; edgeFirstPoint = null; Invalidate(); }