private void addFOB(object obj, EventArgs e) { var icon = new Icon(PanAndZoom.fromLocalToGlobal(editor.LeftClickPoint), startPosNumber++, IconType.CV); scenarioItems.Add(icon); editor.addScenarioItem(icon, true); }
private void addSeaSpawn(object obj, EventArgs e) { var spawn = new Spawn(PanAndZoom.fromLocalToGlobal(editor.LeftClickPoint), spawnNumber++, SpawnType.Sea); scenarioItems.Add(spawn); editor.addScenarioItem(spawn, true); }
private void addLandSpawn(object obj, EventArgs e) { var spawn = new Spawn(PanAndZoom.fromLocalToGlobal(editor.LeftClickPoint), spawnNumber, SpawnType.Land); scenarioItems.Add(spawn); editor.addScenarioItem(spawn, true); //Console.WriteLine("add land spawn"); }
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); }
public void paint(object sen, PaintEventArgs e) { var pos = markers.Select(x => x.getPosition()).ToList(); pos.Add(pos.First()); for (int i = 0; i < pos.Count - 1; i++) { var p1 = pos.ElementAt(i); var p2 = pos.ElementAt(i + 1); Point p = new Point((p1.X + p2.X) / 2, (p1.Y + p2.Y) / 2); creaters.ElementAt(i).setPosition(p); } //e.Graphics.DrawArc(Pens.Red, new Rectangle(20, 20, 400, 200), 10, 170); //e.Graphics.DrawLines(Pens.AliceBlue, x.ToArray()); //Console.WriteLine(pos.ToList()); Color c = new Color(); switch (possession) { case Possession.Redfor: c = Color.FromArgb(80, 255, 0, 0); break; case Possession.Bluefor: c = Color.FromArgb(80, 0, 0, 255); break; case Possession.Neutral: c = Color.FromArgb(80, 255, 255, 255); break; } Brush b = new SolidBrush(c); PanAndZoom.Transform(e); e.Graphics.FillPolygon(b, pos.ToArray()); }