设置所有字段大小和在Vb.Net表单的大小上的位置? [英] Set All Field Size & Location on Vb.Net Form's Size?
问题描述
我再次返回查询:P
我在Vb.Net 2008中使用设计器模式设置了Form1的所有字段".
现在,我想随着用户增加或减小表单大小来设置所有字段的大小和位置".
就像如果用户增加Form1的大小,则所有字段都必须增加大小,并且位置动态与表单的大小相关.
如果用户减小Form1大小,则所有字段都必须减小大小,并且位置动态与窗体的大小相关.
(例如Android SDK安装程序,ACD请参见查看器)
如何编写代码?
谢谢
Hi,
I am Back with Query again, :P
I set All Field of Form1 in Vb.Net 2008 with Designer Mode.
Now I want to Set All Field Size & Location as user increases or decrease the form size.
Like If User Increases Form1 Size All Fields have to Increase Size & Location Dynamic Relate to Form''s Size.
If user Decrease the Form1 Size All Fields have to Decrease Size & Location Dynamic Relate to Form''s Size.
(E.G. Android SDK Installer, ACD See Viewer)
How to Code for It?
Thanks
推荐答案
您可以在Resize事件中手动对其进行编码,也可以通过以下两种方式之一进行编码:
对于简单的表单,请查看锚点 [ ^ ]属性.
有关更复杂的表单,请查看设置面板并使用 Dock a> [^ ]属性. SAKryukov对此问题的解决方案有一个解释: ^ ]
You can code it manually, in the Resize event, or you can do it one of two other ways:
For a simple form, look at the Anchor[^] property.
For more complex forms, look at setting up panels and using the Dock[^] property instead. SAKryukov has an explanation of this a solution to this question: how to dock button so that it can adjust with the form[^]
只需停止手动执行所有操作即可.切勿使用明确的尺寸和位置.将许多垫面板和Dock
属性与Padding
一起使用.它将自动布局所有内容.在某些情况下,可以将容器面板的大小调整为代码中的内容.避免使用Anchors
属性;锚定的表格仍需要手动对齐(可能不准确),并且在调整大小时会忽悠.
另请参阅我过去关于以下主题的答案:
屏幕分辨率更改时,Zom Out发生故障 [ ^ ] —这是关于屏幕分辨率的公差,但是技术是相同的,
另请参见:
GUI外观-C#.Net [类实现背后的代码 [如何停靠按钮,以便它可以调整形式 [
Simply stop doing it all manually. Never use explicit sizes and location. Use many pad panels andDock
properties withPadding
. It will automatically layout everything. In some cases, you can adjust container panel sizes to contents in code. AvoidAnchors
property; anchored Form still needs manual alignment (can be inaccurate) and tends to flicker in resize.
See also my past answers on the topic:
Zom Out malfunctions when Screen resolution changes[^] — this is about tolerance to screen resolution but techniques are the same,
see also:
GUI Apperance - C#.Net[^],
Code behind class implementation[^].
A code sample Griff liked: how to dock button so that it can adjust with the form[^] :-).
—SA
这篇关于设置所有字段大小和在Vb.Net表单的大小上的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!