如何在不重叠的情况下调整组框内控件的大小? [英] How to resize controls inside groupbox without overlapping?

查看:117
本文介绍了如何在不重叠的情况下调整组框内控件的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑一下,我有一个带有两个文本框的简单分组框

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:

  1. 添加具有4列的TableLayoutPanel并将其放置在GroupBox中.
  2. 将标签"放置在"1/3"列之内,并将文本框"放置在"2/4"列之内
  3. 将列1/3的SizeType设置为Autosize,将列2/4的SizeType设置为50%
  4. 将TableLayoutPanel的Anchor-属性设置为Top, Left, Right
  5. 将文本框和标签Dock-属性设置为Fill
  6. 将标签TextAlign-属性设置为MiddleLeft
  1. Add a TableLayoutPanel with 4 columns and place it inside your GroupBox.
  2. Place the Labels inside columns 1/3 and Textboxes inside columns 2/4
  3. Set SizeType of columns 1/3 to Autosize and 2/4 to 50%
  4. Set the Anchor-property of the TableLayoutPanel to Top, Left, Right
  5. Set the Textboxes and Labels Dock-property to Fill
  6. Set the Labels TextAlign-property to MiddleLeft

这篇关于如何在不重叠的情况下调整组框内控件的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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