public IMenuItem Add(string text)
        {
            ToolStripMenuItem subItem = new ToolStripMenuItem(text);

            m_toolStripMenuItem.DropDownItems.Add(subItem);
            MenuItemBridge subItemBridge = new MenuItemBridge(subItem, false);

            m_subItems.Add(subItemBridge);
            return(subItemBridge);
        }
Beispiel #2
0
        public IMenuItem Add(string text)
        {
            ToolStripMenuItem dropDownMenu = new ToolStripMenuItem(text);

            m_menuStrip.Items.Add(dropDownMenu);
            MenuItemBridge dropDownMenuBridge = new MenuItemBridge(dropDownMenu, false);

            m_dropDownMenus.Add(dropDownMenuBridge);
            return(dropDownMenuBridge);
        }
Beispiel #3
0
        public void Remove(IMenuItem menuItem)
        {
            MenuItemBridge subItemBridge = (MenuItemBridge)menuItem;

            if (!m_dropDownMenus.Contains(subItemBridge))
            {
                throw new Exception(
                          "Cannot remove a drop-down menu that is not contained in this menu strip");
            }

            if (menuItem.ReadOnly)
            {
                throw new Exception("Cannot remove a built-in drop-down menu");
            }

            ToolStripMenuItem subItem = subItemBridge.ToolStripMenuItem;

            subItem.Owner.Items.Remove(subItem);

            m_dropDownMenus.Remove(subItemBridge);
        }
Beispiel #4
0
 public IMenuItem Add(string text)
 {
     ToolStripMenuItem subItem = new ToolStripMenuItem(text);
     m_toolStripMenuItem.DropDownItems.Add(subItem);
     MenuItemBridge subItemBridge = new MenuItemBridge(subItem, false);
     m_subItems.Add(subItemBridge);
     return subItemBridge;
 }