更改Windows窗体控件大小 [英] Changing Windows Form Control Size

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

问题描述





我想在每个主要表单大小更改时更改Windows控件大小。假设形式最大化内部控制大小增加,并且当它恢复时,内部控制大小减小。为此我使用内部控件的锚属性,但实际大小缓慢增加而不是减少它。

Hi

I want to change windows control size on every main form size change. Suppose if form maximize the inner control size increase and when it restore then inner control size is decrease. For this i am using anchor property of inner control but the actual size increase slowly and not decrease it.

推荐答案

你必须在这里使用锚定和停靠。根据控件的数量以及哪些应该调整大小,您可以决定控件的锚定和停靠。



我个人使用TableLayoutPanel控件的行和列大小按百分比设定。然后每个单元格都有一个控件, Docking 设置为全部。 TableLayoutPanel本身将 Docking 设置为全部



这意味着现在细胞会随着形状的增长而缩小。由于控件放置在单元格中,它们也会增长和缩小。



对于应保持相同大小的控件,其列和行大小必须设置为绝对值。



这在包含大量控件的表格中非常有用。



看一看在这。您也可以在设计时自行测试。
You will have to use both anchoring and docking here. Depending upon the number of controls and which ones should resize or not, you can decide anchoring and docking for the controls.

I personally use TableLayoutPanel control with row and columns sizes set by percentage. Each cell with then have one control in it with Docking set to All. TableLayoutPanel itself will have Docking set to All.

This means that now cells will grow and shrink with the form. As the controls are placed in the cell, they too will grow and shrink.

For the controls that should remain same size, their column and row size must be set to absolute value.

This is quite useful in a form with lots of controls.

Take a look at this. You can also test things at design time itself.


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

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