No matther what I try the File menu shows the items from Form2 after the three File items from FormMain
The three MergeIndex from FormMain are 0, 5 and 6.
The three MergeIndex from Form2 are 2, 3 and 4.
Yet the File menu always shows the items from FormMain at the top followed by the items from Form2
Sorry about the length of the following.
At first I selected all the Merge code and was going to present only that but I was sure that someone would say there is not enought code.
And I believe that woud be correct.
FORMMAIN
FORM2
The three MergeIndex from FormMain are 0, 5 and 6.
The three MergeIndex from Form2 are 2, 3 and 4.
Yet the File menu always shows the items from FormMain at the top followed by the items from Form2
Sorry about the length of the following.
At first I selected all the Merge code and was going to present only that but I was sure that someone would say there is not enought code.
And I believe that woud be correct.
FORMMAIN
VB.NET:
Public Class FormMain
Private Sub InitializeComponent()
'
'menuStrip_General
'
menuStrip_General.Items.AddRange(New System.Windows.Forms.ToolStripItem() {menuItemFile, menuItemWindowMain, menuItemLayout})
menuStrip_General.Location = New System.Drawing.Point(0, 0)
menuStrip_General.Name = "menuStrip_General"
menuStrip_General.Size = New System.Drawing.Size(528, 24)
menuStrip_General.MdiWindowListItem = menuItemWindowMain
menuStrip_General.AllowMerge = True
menuStrip_General.TabIndex = 1
menuStrip_General.Text = "menuStrip_General"
'MainMenu.BackColor = Color.OrangeRed
'MainMenu.ForeColor = Color.Black
'MainMenu.Text = "File Menu"
'MainMenu.Font = NewFont("Georgia", 16)
'MainMenu.Dock = DockStyle.Left
'ainMenu.BackColor = Color.OrangeRed
'MainMenu.ForeColor = Color.Black
'
'menuItemFile
'
menuItemFile.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {menuItemNew, menuItemExitApp, menuItemCloseSelectedDocument})
menuItemFile.MergeIndex = 0
menuItemFile.Name = "menuItemFile"
menuItemFile.Size = New System.Drawing.Size(64, 20)
menuItemFile.Text = "&File"
'FileMenu.BackColor = Color.OrangeRed
'FileMenu.ForeColor = Color.Black
'FileMenu.Text = "File Menu"
'FileMenu.Font = NewFont("Georgia", 16)
'FileMenu.TextAlign = ContentAlignment.BottomRight
'FileMenu.TextDirection = ToolStripTextDirection.Vertical90
'FileMenu.ToolTipText = "Click Me"
'
'menuItemNew
'
menuItemNew.MergeIndex = 0
menuItemNew.MergeAction = MergeAction.Insert
menuItemNew.Name = "menuItemNew"
menuItemNew.Size = New System.Drawing.Size(147, 22)
menuItemNew.Text = "&New Child Form (Main)"
'
'menuItemExitApp
'
menuItemExitApp.MergeIndex = 6
menuItemExitApp.MergeAction = MergeAction.Insert
menuItemExitApp.Name = "menuItemExitApp"
menuItemExitApp.Size = New System.Drawing.Size(147, 22)
menuItemExitApp.Text = "Exit App (Main)"
'
'menuItemCloseSelectedDocument
'
menuItemCloseSelectedDocument.MergeIndex = 5
menuItemCloseSelectedDocument.MergeAction = MergeAction.Insert
menuItemCloseSelectedDocument.Name = "menuItemCloseSelectedDocument"
menuItemCloseSelectedDocument.Size = New System.Drawing.Size(147, 22)
menuItemCloseSelectedDocument.Text = "Cl&ose Selected Document (Main)"
'
'menuItemWindowMain
'
menuItemWindowMain.MergeIndex = 3
menuItemWindowMain.Name = "ToolStripMenuItemWindow (Main)"
menuItemWindowMain.Size = New System.Drawing.Size(90, 20)
menuItemWindowMain.Text = "&Window (Main)"
'
'menuItemLayout
'
menuItemLayout.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {menuItemAI, menuItemAcs, menuItemHoriz, menuItemVert, menuItemMax, menuItemMin})
menuItemLayout.MergeIndex = 6
menuItemLayout.Name = "menuItemLayout"
menuItemLayout.Size = New System.Drawing.Size(82, 20)
menuItemLayout.Text = "&Layout (Main)"
'
'menuItemAI
'
menuItemAI.MergeIndex = 0
menuItemAI.Name = "menuItemAI"
menuItemAI.Size = New System.Drawing.Size(201, 22)
menuItemAI.Text = "Arrange&Icons (Main)"
'
'menuItemAcs
'
menuItemAcs.MergeIndex = 1
menuItemAcs.Name = "menuItemAcs"
menuItemAcs.Size = New System.Drawing.Size(201, 22)
menuItemAcs.Text = "&Cascade (Main)"
'
'menuItemHoriz
'
menuItemHoriz.MergeIndex = 2
menuItemHoriz.Name = "menuItemHoriz"
menuItemHoriz.Size = New System.Drawing.Size(201, 22)
menuItemHoriz.Text = "Arrange &Horizontal (Main)"
'
'menuItemVert
'
menuItemVert.MergeIndex = 3
menuItemVert.Name = "menuItemVert"
menuItemVert.Size = New System.Drawing.Size(201, 22)
menuItemVert.Text = "Arrange &Vertical (Main)"
'
'menuItemMax
'
menuItemMax.MergeIndex = 4
menuItemMax.Name = "menuItemMax"
menuItemMax.Size = New System.Drawing.Size(201, 22)
menuItemMax.Text = "Ma&ximize all (Main)"
'
'menuItemMin
'
menuItemMin.MergeIndex = 5
menuItemMin.Name = "menuItemMin"
menuItemMin.Size = New System.Drawing.Size(201, 22)
menuItemMin.Text = "Mi&nimize all (Main)"
'
'openFileDlg
'
openFileDlg.AddExtension = False
openFileDlg.Title = "MDI Sample"
'
'Form1
'
AutoScaleBaseSize = New System.Drawing.Size(5, 13)
ClientSize = New System.Drawing.Size(528, 401)
Controls.Add(menuStrip_General)
MainMenuStrip = menuStrip_General
Name = "Form(Main)"
Text = "MDI Example"
IsMdiContainer = True
StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
menuStrip_General.ResumeLayout(False)
menuStrip_General.PerformLayout()
ResumeLayout(False)
PerformLayout()
End Sub
End Class
FORM2
VB.NET:
#Region "Windows Form Designer generated code"
Private Sub InitializeComponent()
'
' menuStrip_General
'
menuStrip_General.Items.AddRange(New ToolStripMenuItem() {menuItemFile})
menuStrip_General.Location = New System.Drawing.Point(0, 0)
menuStrip_General.Name = "menuStrip_General"
menuStrip_General.Size = New System.Drawing.Size(528, 24)
menuStrip_General.AllowMerge = True
menuStrip_General.TabIndex = 1
menuStrip_General.Text = "menuStrip_General"
menuStrip_General.Visible = False
'
' menuItemFile
'
menuItemFile.DropDownItems.AddRange(New ToolStripMenuItem() {menuItemWM, menuItemOpen, menuItemSave})
menuItemFile.MergeIndex = 0
menuItemFile.MergeAction = MergeAction.MatchOnly
menuItemFile.Name = "menuItemFile"
menuItemFile.Size = New System.Drawing.Size(64, 20)
menuItemFile.Text = "&File"
'
' menuItemOpen
'
menuItemOpen.MergeIndex = 2
menuItemOpen.MergeAction = MergeAction.Insert
menuItemOpen.Name = "menuItemOpen"
menuItemOpen.Size = New System.Drawing.Size(147, 22)
menuItemOpen.Text = "&Open" & " (" & sCount & ")"
'
' menuItemWM
'
menuItemWM.MergeIndex = 3
menuItemWM.MergeAction = MergeAction.Insert
menuItemWM.Text = "&Watermark" & " (" & sCount & ")"
'
' menuItemSave
'
menuItemSave.MergeIndex = 4
menuItemSave.MergeAction = MergeAction.Insert
menuItemSave.Text = "&Save" & " (" & sCount & ")"
'
' openFileDlg
'
openFileDlg.AddExtension = False
openFileDlg.Title = "MDI Sample" & " (" & sCount & ")"
'
' panel1
'
panel1.AutoScroll = True
panel1.Controls.AddRange(New Control() {pictureBox1})
panel1.Location = New Point(8, 0)
panel1.Name = "panel1"
panel1.Size = New Size(280, 264)
panel1.TabIndex = 0
'
' pictureBox1
'
pictureBox1.Location = New Point(16, 16)
pictureBox1.Name = "pictureBox1"
pictureBox1.Size = New Size(248, 224)
pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize
pictureBox1.TabIndex = 0
pictureBox1.TabStop = False
'
' saveFileDlg
'
saveFileDlg.FileName = "doc1"
'
' Form2
'
AutoScaleBaseSize = New Size(5, 13)
ClientSize = New Size(292, 273)
Controls.AddRange(New Control() {panel1})
Controls.Add(menuStrip_General)
MainMenuStrip = menuStrip_General
Name = "Form2"
Text = "Child" & " (" & sCount & ")"
WindowState = FormWindowState.Maximized
panel1.ResumeLayout(False)
menuStrip_General.ResumeLayout(False)
menuStrip_General.PerformLayout()
ResumeLayout(False)
PerformLayout()
End Sub
#End Region
End Class
Last edited: