private void button_Delete_Click(object sender, EventArgs e) { int index = ConfigWindow.CustomActionItems.IndexOf(this); int scrollValue = ConfigWindow.GetContextMenuPanelScrollValue(); ConfigWindow.CustomActionItems.Remove(this); Parent.Controls.Remove(this); ConfigWindow.RefreshCustomAcionItems(scrollValue); }
private void button_Delete_Click(object sender, EventArgs e) { if (ConfigWindow.GetContextMenuList().Count == 1) { RemoveItemFocus(); } else { int index = ConfigWindow.GetContextMenuList().IndexOf(this); ConfigWindow.GetContextMenuList()[index != 0 ? index - 1 : index + 1].GiveItemFocus(); } int scrollValue = ConfigWindow.GetContextMenuPanelScrollValue(); ConfigWindow.GetContextMenuList().Remove(this); Parent.Controls.Remove(this); ConfigWindow.RefreshContextMenuItems(scrollValue); }