/// <summary> /// Finds the tool or menu strip items by name or text /// </summary> public static List <ToolStripItem> FindMenuItems(String name) { List <ToolStripItem> found = new List <ToolStripItem>(); for (Int32 i = 0; i < Items.Count; i++) { ToolStripItem item = Items[i]; if (item.Name == name) { found.Add(item); } } ShortcutItem item2 = ShortcutManager.GetRegisteredItem(name); if (item2 != null) { found.Add(item2.Item); } ToolStripItem item3 = ShortcutManager.GetSecondaryItem(name); if (item3 != null) { found.Add(item3); } return(found); }
/// <summary> /// Finds the tool or menu strip item by name or text /// </summary> public static ToolStripItem FindMenuItem(String name) { for (Int32 i = 0; i < Items.Count; i++) { ToolStripItem item = Items[i]; if (item.Name == name) { return(item); } } ShortcutItem item2 = ShortcutManager.GetRegisteredItem(name); if (item2 != null) { return(item2.Item); } ToolStripItem item3 = ShortcutManager.GetSecondaryItem(name); return(item3); }