private void EditPerson() { using (PersonForm form = new PersonForm(_cur_ent.Copy(), _base_map.Entities)) { form.AddLayers(_base_map.Layers); if (form.ShowDialog() == DialogResult.OK) { _base_map.Entities[_base_map.Entities.IndexOf(_cur_ent)] = form.Person; if (Edited != null) { Edited(this, EventArgs.Empty); } } } }
private void PersonItem_Click(object sender, EventArgs e) { using (PersonForm form = new PersonForm(_base_map.Entities)) { form.AddLayers(_base_map.Layers); form.SelectedIndex = CurrentLayer; if (form.ShowDialog() == DialogResult.OK) { form.Person.X = (short)(_mouse.X / Zoom + TileWidth / 2 - 1); form.Person.Y = (short)(_mouse.Y / Zoom + TileHeight / 2 - 1); _base_map.Entities.Add(form.Person); form.Person.Visible = _base_map.Layers[CurrentLayer].Visible; Invalidate(); if (Edited != null) { Edited(this, EventArgs.Empty); } } } }