UltraGridBagLayoutPanel“可堆叠控件”
我想知道如果控件被隐藏或从 UltraGridBagLayoutPanel 中删除,是否有人知道如何使控件堆叠并填充控件留下的可用空间。
示例:
[Textbox 1]
[Textbox 2]
[Textbox 3]
[Textbox 4]
[Textbox 5]
如果我现在隐藏[文本框3],它将平均分散剩余的空间,并用该空间填充剩余的文本框。但是,我希望它这样做...
[Textbox 1]
[Textbox 2]
[Textbox 4]
[Textbox 5]
所有文本框都会向上移动,并且 [Textbox 4] 将完全占用 [Textbox 3] 留下的空间。
有什么想法吗?
I am wondering if anyone has any idea how to make the controls stack and fill up the available space left by a control if the control is hidden or removed from the UltraGridBagLayoutPanel.
Example:
[Textbox 1]
[Textbox 2]
[Textbox 3]
[Textbox 4]
[Textbox 5]
If I hide [Textbox 3] as of now, it will disperse the space left equally and pad the remaining text boxes with the space. However, I would like it to do this...
[Textbox 1]
[Textbox 2]
[Textbox 4]
[Textbox 5]
Where all the text boxes will move up and [Textbox 4] will completely consume the space left by [Textbox 3].
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 TextBox 控件之后为可能隐藏到 GridBagLayoutPanel 的每个文本框添加一个面板,并将其可见性设置为与 TextBox 可见性相反。只要面板与文本框大小相同,它将保留相同的空间,并且文本框将按照您的意愿移动。
You can add a panel for each textbox that you might hide to the GridBagLayoutPanel after the TextBox controls and set it's visibility to be the opposite of the TextBox visiblity. As long as the Panel is the same size as the TextBox then it will reserve the same amount of space and the text boxes will move as you would like.