Merging menu items for MDI container and MDI child forms
Say, if MDI container has a "About" Menu that the MDI child forms need to merge with.
Set the MDI container menu in such manner. (In the InitializeComponent or change it using the IDE property window)
this.menuItemAbout.Index = 1;
this.menuItemAbout.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItemMainHelp});
this.menuItemAbout.MergeOrder = 1;
this.menuItemAbout.MergeType = System.Windows.Forms.MenuMerge.MergeItems;
this.menuItemAbout.Text = "Help";
this.menuItemMainHelp.Index = 0;
this.menuItemMainHelp.MergeOrder = 1000; //this need to be larger than the child so that it appear //underneath the child menu items.
this.menuItemMainHelp.Text = "Main Help";
this.menuItemMainHelp.MergeType = System.Windows.Forms.MenuMerge.Add;
Set MDI child forms in such manner. (In the InitializeComponent or change it using the IDE property window)
this.menuItemAbout.Index = 1;
this.menuItemAbout.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItemChildHelp});
this.menuItemAbout.MergeOrder = 1;
this.menuItemAbout.MergeType = System.Windows.Forms.MenuMerge.MergeItems;
this.menuItemAbout.Text = "Help";
this.menuItemChildHelp.Index = 0;
this.menuItemChildHelp.MergeOrder = 100;
this.menuItemChildHelp.Text = "My Child Help";
this.menuItemChildHelp.MergeType = System.Windows.Forms.MenuMerge.Add;
this.menuItemChildHelp.Click += new System.EventHandler(this.menuItemChildHelp_Click);
Set the MDI container menu in such manner. (In the InitializeComponent or change it using the IDE property window)
this.menuItemAbout.Index = 1;
this.menuItemAbout.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItemMainHelp});
this.menuItemAbout.MergeOrder = 1;
this.menuItemAbout.MergeType = System.Windows.Forms.MenuMerge.MergeItems;
this.menuItemAbout.Text = "Help";
this.menuItemMainHelp.Index = 0;
this.menuItemMainHelp.MergeOrder = 1000; //this need to be larger than the child so that it appear //underneath the child menu items.
this.menuItemMainHelp.Text = "Main Help";
this.menuItemMainHelp.MergeType = System.Windows.Forms.MenuMerge.Add;
Set MDI child forms in such manner. (In the InitializeComponent or change it using the IDE property window)
this.menuItemAbout.Index = 1;
this.menuItemAbout.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItemChildHelp});
this.menuItemAbout.MergeOrder = 1;
this.menuItemAbout.MergeType = System.Windows.Forms.MenuMerge.MergeItems;
this.menuItemAbout.Text = "Help";
this.menuItemChildHelp.Index = 0;
this.menuItemChildHelp.MergeOrder = 100;
this.menuItemChildHelp.Text = "My Child Help";
this.menuItemChildHelp.MergeType = System.Windows.Forms.MenuMerge.Add;
this.menuItemChildHelp.Click += new System.EventHandler(this.menuItemChildHelp_Click);
Comments