表单大小增加时增加控件的大小 [英] Increase the size of the controls when form size increases

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

问题描述

嗨朋友..
表单大小增加时,如何增加表单中每个控制项的大小.控件之间不应再合并一件事.Anchor属性无法正常工作.


我在表单中有标签,文本框,按钮...在调整表单大小时,标签,文本框和按钮的大小将增加,并且应适当分配并且应放置在表单的中心...请发送给我一个示例应用程序.

在此先感谢...

hi friends..
how to increase the size of each and every cotrol in the form when the form size increases. and one more thing the controls should not merge each other.. Anchor Property is not working fine.


I have Labels, TextBoxes, Buttons in the form... when resizing the form the labels, textboxes and the buttons size will be increase and the allignment should be proper and should be placed in the center on the form... please send me one sample application.

thanks in advance...

推荐答案

您是对的,最好不要使用锚点.同时,也不能改变每个控件的大小.您可以尝试(仅响应resize事件),但是它可能很难看.原因之一:大小更改将改变长宽比.最好使用基于Dock的架构,尤其要使用System.Windows.Forms.DockStyle.Fill样式.只有这种样式的控件才会更改大小和形状.

请查看我过去对尺寸公差设计的建议:
屏幕分辨率改变时,Zom Out发生故障 [ ^ ];
另请参见:
GUI外观-C#.Net [
You''re right, better don''t use anchor. At the same time, it''s not good too change the size of every control. You can try (just respond to resize event), but it can be ugly. One reason: change in size will change aspect ratio. It''s much better to use the schema based on Dock and using, in particular, System.Windows.Forms.DockStyle.Fill style. Only the controls of this style will change the size and shape.

Please see my past advices of size-tolerant design:
Zom Out malfunctions when Screen resolution changes[^];
see also:
GUI Apperance - C#.Net[^].

—SA


希望您使用的是C#winforms.使用对控件具有双重缓冲性质的表布局窗格.在这里,根据需要划分单元格/行/列!用Dock样式的FIll放置一个控件..

您可以将其视为HTML Table 100%的高度/宽度调整.使用表格"布局面板,一切皆有可能.

享受C#提供的便利!有任何评论吗?
Hope you are using C# winforms. Use table layout pane with double buffered nature to the control. Here, divide the cell / rows / columns as you need ! Place a control there with Dock style FIll ..

You can feel it as HTML Table 100% hieght / width adjustments. Every thing is possible with Table layout panel.

Enjoy the C# given facilities ! Any comments ?


这篇关于表单大小增加时增加控件的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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