Menustrip control10/29/2022 Replacing a target menu item with a source menu item of the same name that does something different.įinds a text match, or uses the MergeIndex value if no text match is found, and then adds all the drop-down items from the source to the target.īuilding a menu structure that inserts or adds menu items into a submenu, or removes menu items from a submenu. Set MergeIndex appropriately to preserve the original order.įinds a text match, or uses the MergeIndex value if no text match is found, and then replaces the matching target menu item with the source menu item. If the value of MergeIndex is the same for both menu items, they are added in reverse order. (Default) Adds the source item to the end of the target item's collection.Īdding menu items to the end of the menu when some part of the program is activated.Īdds the source item to the target item's collection, in the location specified by the MergeIndex property set on the source item.Īdding menu items to the middle or the beginning of the menu when some part of the program is activated. The following table describes the meaning and typical use of the available merge actions. You set the merge action on menu items in the source MenuStrip using the MergeAction property. MenuStrip merging moves menu items from one ToolStrip to another rather than cloning them, as was the case with MainMenu. #MENUSTRIP CONTROL MANUAL#In both manual and automatic merging, each merge action affects the next merge action. The menu items merge in the same way for both methods, but the merge is activated differently, as discussed in the "Manual Merging" and "Automatic Merging" sections later in this topic. You can merge menu items manually or automatically. The IsMdiWindowListEntry property identifies which menu items come from a MenuStrip on an MDI child form. For example, you typically list MDI children that are currently open on the Window menu. The MdiWindowListItem property identifies the menu item whose drop-down list you will populate with the titles of the current MDI parent form's MDI children. The source is the MenuStrip control on the MDI child form that contains the menu items you want to merge into the target menu. The target is the MenuStrip control on the main or MDI parent form into which you are merging menu items. Merging procedures involve both a target and a source control: This topic describes the basic concepts associated with merging menu items in an MDI application. Use this constructor to create a MenuStrip to which you can add ToolStripMenuItem objects.If you have a multiple-document interface (MDI) application, you can merge menu items or whole menus from the child form into the menus of the parent form. ' The Form.MainMenuStrip property determines the merge target. ' Dock the MenuStrip to the top of the form. ' Add the window ToolStripMenuItem to the MenuStrip. ' Assign the ToolStripMenuItem that displays (windowNewMenu)ĬType(windowMenu.DropDown, ToolStripDropDownMenu).ShowImageMargin = FalseĬType(windowMenu.DropDown, ToolStripDropDownMenu).ShowCheckMargin = True ' Create a MenuStrip control with a new window.ĭim windowMenu As New ToolStripMenuItem("Window")ĭim windowNewMenu As New ToolStripMenuItem("New", Nothing, New EventHandler(AddressOf windowNewMenu_Click)) The Form.MainMenuStrip property determines the merge target. Dock the MenuStrip to the top of the form. Add the window ToolStripMenuItem to the MenuStrip. Assign the ToolStripMenuItem that displays ((ToolStripDropDownMenu)(windowMenu.DropDown)).ShowCheckMargin = true ((ToolStripDropDownMenu)(windowMenu.DropDown)).ShowImageMargin = false ToolStripMenuItem windowNewMenu = new ToolStripMenuItem("New", null, new EventHandler(windowNewMenu_Click)) ToolStripMenuItem windowMenu = new ToolStripMenuItem("Window") Create a MenuStrip control with a new window. This example is part of a larger example provided for the ToolStripPanel class. #MENUSTRIP CONTROL CODE#The following code example demonstrates the MenuStrip constructor. MenuStrip() public MenuStrip () Public Sub New () Examples Initializes a new instance of the MenuStrip class.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |