Windows的自动调整大小窗体控件 [英] Automatic resizing of the Windows Forms controls

查看:220
本文介绍了Windows的自动调整大小窗体控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用VS2008的设计师这样做。

I'm using VS2008's designer for doing this.

例如,如果我大小的窗口形式说500×500,我加一个DataGridView它(490x490)。

For example if I've a windows form of size say 500x500 and I added a DataGridView to it (490x490).

当我运行这个程序。和最大化的形式,在DataGridView仍然是相同的大小。的额外空间剩下的就是在窗体上的空白。我想DataGridView中也采取了整个窗口的大小。

when I run this program. and maximize the form, the DataGridView still remains of the same size. rest of the additional space is blank on the form. I want DataGridView to also take the entire window size.

没有软件会这样。我不知道该怎么改序得到期望的行为。

No software will be like that. I don't know what to change inorder get desired behaviour.

推荐答案

您可以使用基座或更多的precise控制使用Anchor属性。通过设置锚点,以左,右,上,下​​控制将扩展与窗口。通过设置锚点到右的控制将与右侧边缘移动。通过设置锚顶部和底部的控制将垂直缩放,但有一个固定的宽度。只是实验

You can use Dock, or for more precise control use the Anchor property. By setting Anchor to Left, Right, Top, Bottom the control will scale with the window. By setting Anchor to Right the control will move with the right border. By setting Anchor to Top and Bottom the control will scale vertically, but have a fixed width. Just experiment

这篇关于Windows的自动调整大小窗体控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆