private void SpecialEdit_FormClosing(object sender, FormClosingEventArgs e) { if (levelEdit != null) { levelEdit.Dispose(); levelEdit = null; } }
private void SpecialEdit_Load(object sender, EventArgs e) { specialCopy = (Special)Edit.Copy(); levelEdit = new LevelEdit(); levelEdit.Palette = Palette; levelEdit.LevelList = LevelList; levelEdit.NoIcon = true; levelEdit.BackColor = this.BackColor; levelEdit.FormBorderStyle = FormBorderStyle.None; levelEdit.TopLevel = false; levelEdit.Parent = panelLevelEdit; foreach (ControlType type in Enum.GetValues(typeof(ControlType))) { if (type != ControlType.Unknown) { cboControls.Items.Add(type); } } switch ((SpecialType)specialCopy.Type) { case SpecialType.Controls: gameControl = specialCopy.GetGameControl(); chkControls.Checked = true; break; case SpecialType.Flower: flower = specialCopy.GetFlower(); chkFlower.Checked = true; break; default: level = specialCopy.GetLevel(); int size = LevelList.Count; for (int i = 0; i < size; i++) { ListItem item = LevelList[i]; Grid map = (Grid)item.Value; if (map.FileName == level.File) { level.Name = map.Name; break; } } chkLevel.Checked = true; break; } }