/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void addStage_Click(object sender, EventArgs e) { // make clone of the first stage MEXStageIcon icon = MEX.StageIcons[0]; // unless one is already selected if (stageListBox.SelectedItem is MEXStageIcon ico) { icon = ico; } var iconImage = icon.Image; icon.Image = null; var clone = icon.Copy(); clone.Stage = MEX.StageIcons[0].Stage; clone.X = -clone.Width / 2; clone.Y = -clone.Height / 2; clone.Image = iconImage.Copy(); icon.Image = iconImage; MEX.StageIcons.Insert(MEX.StageIcons.Count - 1, clone); stageListBox.ClearSelected(); stageListBox.SelectedItem = clone; }
/// <summary> /// /// </summary> private MEXStageIcon[] UpdatePropertyGrid() { RefreshPanel(); var items = new MEXStageIcon[stageListBox.SelectedItems.Count]; for (int i = 0; i < items.Length; i++) { items[i] = (MEXStageIcon)stageListBox.SelectedItems[i]; } if (mxPropertyGrid1 != null && items.Length > 0) { mxPropertyGrid1.SelectedObjects = items; } if (items.Length == 1) { locationBox.Text = "Stage Location..."; stageNameBox.Text = items[0].ToString(); } return(items); }