Windows Develop Bookmark and Share   
 index > Windows Forms General > Maximized Mdi Child is is cropped in mdi Parent
 

Maximized Mdi Child is is cropped in mdi Parent

I think this is an easy solution. All i did is create an mdi parent that is maximized, next I created a mdi child and set it to open in centerparent, with same size as parent, and no controlbox and border style. Thus, I have a maximized parent and want the mdi child to open up maximized in there. Although it does open in the parent and is maximized, the top is cropped (it is too way up in the parent form). What am I doing wrong?
lostron  Thursday, January 03, 2008 12:59 AM

Hi, lostron,

Based on my understanding, when you open your maximized, none-border Child Form in your Mdi Parent Form, there is still some distance between the top of the Child Form and the top of yourMdi Parent Form, right?

I think this behavior is by design.

A trickyworkaround is to set the WindowState to Normal, but set the Dock of the Child Form to DockStyle.Fill.

For exmample

Code Block

Form2 form = new Form2();

form.MdiParent = this;

form.StartPosition = FormStartPosition.CenterParent;

form.Dock = DockStyle.Fill;

form.Show();

More info

http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.dock.aspx

Hope this helps,

Regards

Yu Guo â€?MSFT  Monday, January 07, 2008 2:35 AM

Hi, lostron,

Based on my understanding, when you open your maximized, none-border Child Form in your Mdi Parent Form, there is still some distance between the top of the Child Form and the top of yourMdi Parent Form, right?

I think this behavior is by design.

A trickyworkaround is to set the WindowState to Normal, but set the Dock of the Child Form to DockStyle.Fill.

For exmample

Code Block

Form2 form = new Form2();

form.MdiParent = this;

form.StartPosition = FormStartPosition.CenterParent;

form.Dock = DockStyle.Fill;

form.Show();

More info

http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.dock.aspx

Hope this helps,

Regards

Yu Guo â€?MSFT  Monday, January 07, 2008 2:35 AM

You can use google to search for other answers

Custom Search

More Threads

• Property Grid
• Shared config file
• prefix 'this.'
• Finding a list of rectangles from a list of points
• IEExec.exe crashes after assembly update
• Changing the Mouse Cursor on ListView
• exception from hresult 0x800a5077 when opening crystal report
• How to access events for controls added at runtime?
• Problem with TreeView refreshing
• Dynamically Resizing a Control