Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Size/Location of Winforms MDI Client Area

Inside an MDI form is a client area that hosts the mdi child forms. How do I find out how big that area is? The best I can come up with so far is finding the total size of the parent's potential client area (mdiparent.ClientRectangle) and then subtracting off the sizes of components like toolbars, etc that take away from the client area. Is there a better way?

like image 491
Jeff Avatar asked Mar 02 '09 20:03

Jeff


1 Answers

There is no property on a form that gives you access to the MDI client window. But you can find it back like this:

public MdiClient GetMdiClientWindow() {
  foreach (Control ctl in this.Controls) {
    if (ctl is MdiClient) return ctl as MdiClient;
  }
  return null;
}

From there, just use its Size property.

like image 157
Hans Passant Avatar answered Oct 03 '22 03:10

Hans Passant