Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have windows forms app in which there is one MDI Parent form with one menu strip in the parent itself only and many child forms. The issue that I am facing is the menu strip expands vertically when I maximize the child form in the MDI parent form.
See below screenshots on imgur
Normal state Click to see Normal
Maximised state Click to see Maximised

See this

This is the MDI Parent designer code
//
// frmManager
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.AliceBlue;
this.BackgroundImage = global::DeskTimeWinApp.Properties.Resources.DeskTimeFullBrandLogo;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.ClientSize = new System.Drawing.Size(1184, 711);
this.Controls.Add(this.ManagerMenu);
this.DoubleBuffered = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.IsMdiContainer = true;
this.MainMenuStrip = this.ManagerMenu;
this.MaximumSize = new System.Drawing.Size(1920, 1080);
this.MinimumSize = new System.Drawing.Size(1200, 750);
this.Name = "frmManager";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Manager";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmManager_FormClosing);
this.Load += new System.EventHandler(this.frmManager_Load);
this.ManagerMenu.ResumeLayout(false);
this.ManagerMenu.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();


This is the menustrip code from designer
//
// ManagerMenu
//
this.ManagerMenu.BackColor = System.Drawing.Color.AliceBlue;
this.ManagerMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.taskMenuItem,
this.taskMasterMenuItem,
this.employeeMenuItem,
this.employeeReportsMenuItem,
this.reportsMenuItem,
this.versionMenuItem,
this.helpMenuItem});
this.ManagerMenu.Location = new System.Drawing.Point(0, 0);
this.ManagerMenu.Name = "ManagerMenu";
this.ManagerMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
this.ManagerMenu.Size = new System.Drawing.Size(1184, 24);
this.ManagerMenu.TabIndex = 0;
this.ManagerMenu.Text = "menuStrip1";


What I have tried:

I changed anchor and dock properties of the menu strip and the even once removed and added a new menu strip.
Posted
Updated 17-Nov-20 22:23pm
v3
Comments
Richard MacCutchan 17-Nov-20 9:49am    
Too much of the image is redacted.
Christopher Fernandes 17-Nov-20 9:56am    
That image is just an icon of the parent form. Can you tell me why the menu strip is expanding.
Richard MacCutchan 17-Nov-20 10:01am    
How could I? I have no idea what your code is doing.
Richard MacCutchan 17-Nov-20 10:36am    
Take out the BackgroundImage and see what happens.
[no name] 17-Nov-20 9:58am    
You're "stretching", but since you won't show any code, no one knows how because there is usually more than one way.

1 solution

Check to make sure the MenuStrip is docked 'Top (its default setting if you drag and drop it at design-time) in the MDI main/parent window.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900