public MapEditor(TileBank tb, MapEditorState mes, string mapname) { InitializeComponent(); pictureBox1.TileBank = tb; this.FormClosing += new FormClosingEventHandler((o, e) => { mes.CloseMapEditor(mapname); }); vScrollBar1.LargeChange = 1; hScrollBar1.LargeChange = 1; pictureBox1.MouseMove += new MouseEventHandler((o, e) => { mes.coordlabel.Text = "Coords: x=" + mouseoverpointx + ", y=" + mouseoverpointy; m_map.ScreenToMapCoords(e.X, e.Y, out mouseoverpointx, out mouseoverpointy); if (e.Button == MouseButtons.Left) { mes.ApplyFloor(m_map, mouseoverpointx, mouseoverpointy); } }); pictureBox1.MouseDown += new MouseEventHandler((o, e) => { m_map.ScreenToMapCoords(e.X, e.Y, out mouseoverpointx, out mouseoverpointy); if (e.Button == MouseButtons.Left) { mes.ApplyFloor(m_map, mouseoverpointx, mouseoverpointy); } }); }
public MapList(MapEditorState mes, ToolStripMenuItem mnuitem) { InitializeComponent(); mes.maps.Keys.ToList().ForEach(x => { listBox1.Items.Add(new MapInfo(x)); }); mes.RegisterWindow("MapList", this, mnuitem); this.FormClosing += new FormClosingEventHandler((o, e) => { mes.DeregisterWindow("MapList"); }); this.mes = mes; }
public Floors(MapEditorState mes, ToolStripMenuItem tsmi) { InitializeComponent(); mes.RegisterWindow("Floors", this, tsmi); this.FormClosing += new FormClosingEventHandler((o, e) => { mes.DeregisterWindow("Floors"); }); mes.floortypes.ToList().ForEach(x => { MapFloor floor = (MapFloor)Activator.CreateInstance(x.Value); Image img = mes.tilebank.GetTileImage(floor.TileIndex); RadioButton rb = new RadioButton(); rb.Appearance = Appearance.Button; rb.Image = img; rb.Size = img.Size; flowLayoutPanel1.Controls.Add(rb); rb.Tag = floor; rb.MouseDown += new MouseEventHandler((ob, ev) => { if (ev.Button == MouseButtons.Right) { contextMenuStrip1.Show(rb, ev.Location); contextMenuStrip1.Tag = rb; } }); rb.CheckedChanged += new EventHandler((ob, ev) => { if (rb.Checked) { mes.selectedFloor = x.Value; } }); if (mes.selectedFloor == x.Value) { rb.Checked = true; } }); }