Winforms MDI客户区的大小/位置

编程入门 行业动态 更新时间:2024-10-27 00:29:50
本文介绍了Winforms MDI客户区的大小/位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在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客户区的大小/位置

本文发布于:2023-10-08 08:53:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1472121.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:大小   位置   客户   Winforms   MDI

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!