maximize the MDI child

J

Jassim Rahma

how can I maximize the MDI child in the free MDI parent area not in the
whole window.. I mean in the (whole window area - menubar - tool bar) so i
want the MDi child to show its whole window and caption bar within the MDI
container.
 
P

Peter Duniho

Jassim said:
how can I maximize the MDI child in the free MDI parent area not in the
whole window.. I mean in the (whole window area - menubar - tool bar) so
i want the MDi child to show its whole window and caption bar within the
MDI container.

I don't know that you can. The general point of the maximize behavior
for an MDI child is that the caption bar gets merged with the menu of
the parent window.

However, you could simulate the behavior by checking the WindowState in
the OnResize method of your child form, and if it's Maximized, manually
reset the WindowsState to Normal and adjust the window size and position
to fit where you want it.

I played with this a little, and found that by insetting the parent's
ClientRectangle 5 pixels in width and height, that accounted for the
internal frame you get when a form is an MdiContainer. There might be a
direct way to get these metrics, but if there is I don't know.

For that matter, I haven't done any MDI stuff other than to fiddle
around with it, so I suppose there's a better, more-approved way to
avoid the merging behavior. But if there is, I don't see it.

Pete
 
G

Guest

You could set the WindowState of the MDI child to FormWindowState.Maximized
when the form loads or when the user presses a button for example. Another
thing you could also do is set the Dock property of the MDI child to
DockStyle.Fill, again depending on what you want to do.

Adrian.
 
J

Jassim Rahma

docking worked...

thank you very much..


Adrian Voicu said:
You could set the WindowState of the MDI child to
FormWindowState.Maximized
when the form loads or when the user presses a button for example. Another
thing you could also do is set the Dock property of the MDI child to
DockStyle.Fill, again depending on what you want to do.

Adrian.
--
[Please mark my answer if it was helpful to you]




Jassim Rahma said:
how can I maximize the MDI child in the free MDI parent area not in the
whole window.. I mean in the (whole window area - menubar - tool bar) so
i
want the MDi child to show its whole window and caption bar within the
MDI
container.
 
J

Jassim Rahma

how can i make sure the MDI child will be docked when the user clicked on
the maximize button without it's being maximized first!! I tried this but
didn't work.

private void TerminalForm_ResizeBegin(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Maximized)
{
this.Dock = DockStyle.Fill;
}
}



Adrian Voicu said:
You could set the WindowState of the MDI child to
FormWindowState.Maximized
when the form loads or when the user presses a button for example. Another
thing you could also do is set the Dock property of the MDI child to
DockStyle.Fill, again depending on what you want to do.

Adrian.
--
[Please mark my answer if it was helpful to you]




Jassim Rahma said:
how can I maximize the MDI child in the free MDI parent area not in the
whole window.. I mean in the (whole window area - menubar - tool bar) so
i
want the MDi child to show its whole window and caption bar within the
MDI
container.
 

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