dotnetmonitor.com |
|
||||||||||||
The MDI related features around MenuStrip are described
below. Using a MenuStrip in MDI requires Form.MainMenuStrip to be set in order to
identiy the controlling MenuStrip. It will be used for child window control menu
merging when children are maximized. Automatic merging between child and parent
forms is triggered by child activation.
ToolStripMenuItem ToolStrip.MDIWindowListItemThis property identifies the item whose drop down should be populated with the titles of MDI children associated with this MDI Parent. ToolStripMenuItem.IsMdiWindowListEntryThis property can be used to do post item customization of the MDI window list. This is how you would identify which items are sourced from an MDI child. Automatic mergingMerging in the automatic case is triggered by MDI child activation and deactivation. Upon activation, the MenuStrip in the child form is merged into the MDIParents MainMenuStrip. Later with subsequent deactivation/activation pairs as a new form becomes active the last form is unmerged (RevertMerge), then the new form is merged. This behavior can be tweaked via mergeAction property on each ToolStripItem and through the AllowMerge property on MenuStrip.
Only MenuStrips participate in automatic merging. To merge ToolStrips, StatusStrip etc, you must merge them manually.
NOTE: See the manual merging sections in ToolStripManager section 7.1. Procedure for automatically merging an MDI child menu into a MDI parentThe following proceedure discusses how to use automatic merging in an MDI application with MenuStrip.
1. Create the MDI parent form as usual, setting MainForm.IsMdiContainer = true. 2. Add a MenuStrip to the MDI parent, setting MainForm.MainMenuStrip = menuStrip1 3. Create an MDI child form, setting MdiChildForm.MdiParent = MainForm 4. Add a MenuStrip to the MDI child 5. Set the MenuStrip in the MdiChildForm to Visible = false 6. Add menu items to the MdiChildForm that you want to merge into the MainForms MainMenuStrip when the MdiChildForm is activated. 7. Use the MergeAction property on the items in the MdiChilds MenuStrip to control how the items on the MDIChildForm merge into the MainForm. |
||||||||||||
|
||||||||||||