public void createMarker(object obj, MouseEventArgs e) { if (e.Button != MouseButtons.Left) { return; } var creater = (CreaterMarker)obj; var marker = new VertexMarker(); marker.setPosition(creater.getPosition()); marker.MouseClick += new MouseEventHandler(deleteMarker); markers.Insert(creaters.IndexOf(creater) + 1, marker); parent.Controls.Add(marker); marker.BringToFront(); var c = new CreaterMarker(); c.MouseClick += new MouseEventHandler(createMarker); parent.Controls.Add(c); creaters.Insert(creaters.IndexOf(creater) + 1, c); parent.Invalidate(); }
public Outline(List <Point> nodes) { this.nodes = nodes; foreach (var n in nodes) { var marker = new VertexMarker(); marker.setPosition(n); marker.MouseClick += new MouseEventHandler(deleteMarker); markers.Add(marker); marker.BringToFront(); var c = new CreaterMarker(); c.MouseClick += new MouseEventHandler(createMarker); //parent.Controls.Add(c); creaters.Add(c); } paintEvent = new PaintEventHandler(paint); }
public Outline(Point center) { var sideLength = 50; center.Offset(-sideLength / 2, -sideLength / 2); nodes.Add(PanAndZoom.fromLocalToGlobal(center)); center.Offset(0, sideLength); nodes.Add(PanAndZoom.fromLocalToGlobal(center)); center.Offset(sideLength, 0); nodes.Add(PanAndZoom.fromLocalToGlobal(center)); center.Offset(0, -sideLength); nodes.Add(PanAndZoom.fromLocalToGlobal(center)); //parent.Controls.Add(this); //BringToFront(); foreach (var n in nodes) { var marker = new VertexMarker(); marker.setPosition(n); marker.MouseClick += new MouseEventHandler(deleteMarker); markers.Add(marker); marker.BringToFront(); var c = new CreaterMarker(); c.MouseClick += new MouseEventHandler(createMarker); //parent.Controls.Add(c); creaters.Add(c); } paintEvent = new PaintEventHandler(paint); }