在MDI表单内部是一个托管mdi子表单的客户区.我如何知道该面积有多大?到目前为止,我能想到的最好的方法是找到父级潜在客户区域的总大小(mdiparent.ClientRectangle),然后减去从客户区域中拿走的工具栏等组件的大小.有更好的方法吗?
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?
推荐答案表单上没有可用于访问MDI客户端窗口的属性.但是您可以像这样找到它:
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; }从那里开始,只需使用其Size属性即可.
From there, just use its Size property.
更多推荐
Winforms MDI客户区的大小/位置
发布评论