如何在不重叠的情况下调整组框内控件的大小? [英] How to resize controls inside groupbox without overlapping?
本文介绍了如何在不重叠的情况下调整组框内控件的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
考虑一下,我有一个带有两个文本框的简单分组框
Consider I have a simple group box with two textboxes
展开窗口时,我想调整标签和文本框的大小.因此,我使用了Anchor属性,但是它变得重叠了. Textbox1与textbox2重叠.
When I expand the window I want to resize the my label and textbox. So I used the Anchor property, but it is getting overlapped. Textbox1 is overlapping with textbox2.
如何在不重叠的情况下保持基于表单大小的大小增加
How can I maintain the size increase based on form size without overlapping
推荐答案
您可以实现所需的目标:
You can achieve what you want like this:
- 添加具有4列的TableLayoutPanel并将其放置在GroupBox中.
- 将标签"放置在"1/3"列之内,并将文本框"放置在"2/4"列之内
- 将列1/3的
SizeType
设置为Autosize
,将列2/4的SizeType
设置为50%
- 将TableLayoutPanel的
Anchor
-属性设置为Top, Left, Right
- 将文本框和标签
Dock
-属性设置为Fill
- 将标签
TextAlign
-属性设置为MiddleLeft
- Add a TableLayoutPanel with 4 columns and place it inside your GroupBox.
- Place the Labels inside columns 1/3 and Textboxes inside columns 2/4
- Set
SizeType
of columns 1/3 toAutosize
and 2/4 to50%
- Set the
Anchor
-property of the TableLayoutPanel toTop, Left, Right
- Set the Textboxes and Labels
Dock
-property toFill
- Set the Labels
TextAlign
-property toMiddleLeft
这篇关于如何在不重叠的情况下调整组框内控件的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文