UltraGridBagLayoutPanel“可堆叠控件”

发布于 2024-12-28 18:28:28 字数 385 浏览 4 评论 0原文

我想知道如果控件被隐藏或从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天暗了我发光 2025-01-04 18:28:28

您可以在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文