Summary description for MenuItemEx.
Inheritance: System.Windows.Forms.MenuItem
Ejemplo n.º 1
0
        static public MenuItem CloneMenu(MenuItemEx currentItem)
        {
            MenuItemEx clonedItem = new MenuItemEx(currentItem.Text, (Bitmap)currentItem.Icon,
                                                   (Shortcut)currentItem.Shortcut, currentItem.ClickHandler);

            // Preserve the enable and check state
            clonedItem.Enabled    = currentItem.Enabled;
            clonedItem.Checked    = currentItem.Checked;
            clonedItem.RadioCheck = currentItem.RadioCheck;

            foreach (MenuItemEx item in currentItem.MenuItems)
            {
                clonedItem.MenuItems.Add(CloneMenu(item));
            }
            return(clonedItem);
        }
Ejemplo n.º 2
0
        void CreateContextMenu()
        {
            // context menu
            MenuItemEx largeIconsMenu = new MenuItemEx("Large Icons", new EventHandler(OnContextMenu));
            MenuItemEx smallIconsMenu = new MenuItemEx("Small Icons", new EventHandler(OnContextMenu));
            MenuItemEx separator1 = new MenuItemEx("-", new EventHandler(OnContextMenu));
            MenuItemEx renameGroup = new MenuItemEx("Rename Group", new EventHandler(OnContextMenu));
            MenuItemEx separator2 = new MenuItemEx("-", new EventHandler(OnContextMenu));
            MenuItemEx renameShortcut = new MenuItemEx("Rename Shortcut", new EventHandler(OnContextMenu));

            contextMenu = new ContextMenu();
            contextMenu.MenuItems.Add(0, largeIconsMenu);
            contextMenu.MenuItems.Add(1, smallIconsMenu);
            contextMenu.MenuItems.Add(2, separator1);
            contextMenu.MenuItems.Add(3, renameGroup);
            contextMenu.MenuItems.Add(4, separator2);
            contextMenu.MenuItems.Add(5, renameShortcut);

            contextMenu.Popup += new EventHandler(ContextMenuPopup);
            this.ContextMenu = contextMenu;
        }
Ejemplo n.º 3
0
		static public MenuItem CloneMenu(MenuItemEx currentItem)
		{
			MenuItemEx clonedItem = new MenuItemEx(currentItem.Text, (Bitmap)currentItem.Icon,
				(Shortcut)currentItem.Shortcut, currentItem.ClickHandler);
			// Preserve the enable and check state
			clonedItem.Enabled = currentItem.Enabled;
			clonedItem.Checked = currentItem.Checked;
			clonedItem.RadioCheck = currentItem.RadioCheck;

			foreach (MenuItemEx item in currentItem.MenuItems)
			{
				clonedItem.MenuItems.Add(CloneMenu(item));
			}
			return clonedItem;
		}