How to resize controls inside groupbox without overlapping?

女生的网名这么多〃 提交于 2020-01-03 05:10:09

问题


Consider I have a simple group box with two textboxes

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


回答1:


You can achieve what you want like this:

  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


来源:https://stackoverflow.com/questions/46316025/how-to-resize-controls-inside-groupbox-without-overlapping

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!