Size/Location of Winforms MDI Client Area

馋奶兔 提交于 2019-11-28 11:04:05

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.

Here's a variant of that code in vb.net:

Public Function GetMdiClientWindowSize() As Size
    For Each ctl As Control In Me.MdiParent.Controls
        If TypeOf ctl Is MdiClient Then
            Return ctl.Size
        End If
    Next
    Return Nothing
End Function
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!