How to maximize MDI child?

B

Brett Romero

I set an MDI child form to Windowstate=maximized at design time. When
I new up and show the child form in the MDI parent, the child's title
is hidden since it's pushed to far up (below parent tool bar). On the
MDI parent, the resize icon is displayed in the top right. That means
the child is maximized right? What doesn't it fill the parent
container area?

When I click the resize icon, the child then jumps to the parent center
and the bottom quarter is hidden out of veiw. I can scroll down to see
it. Now I can see the maximize icon on the child. When I click it,
the child finally maximizes in the parent container space.

I have the child's StartPosition=CenterParent. It seems start position
doen't matter much here. I always have to go through the three step
process to get the child maximized.

Any ideas why the child doesn't start maximized?

Thanks,
Brett
 
B

Brett Romero

I've resolved most of the problem here. I now run this set of code
after creating and before showing the child form:

Rectangle mdiClientArea = Rectangle.Empty;
foreach (Control c in this.Controls)
{
if (c is MdiClient)
mdiClientArea = c.ClientRectangle;
}

childForm.Bounds = mdiClientArea;
childForm.MdiParent = this;

This started the first child form (which loads with the load) not fully
maximized. I then did this

this.Size = Program.settings.frmShellSize;

The above code gets values from a config file and sizes the parent.
Putting my mdiClientArea code before the above sizes the child to the
parent's design time size, which wasn't what I wanted.

I still have an issue with the parent displaying a maximize/restore
icon for the child. I've disabled the child's maximize. If any one
clicks the parent's restore for the child, the child turns into a
vertical line about 2 pixels wide. Any idea how I can get the parent
to stop displaying max/restore icon for the child? I want the children
always maximized.

Thanks,
Brett
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top