使用.NET“WinForms” SplitContainer控件,如何动态隐藏面板?

发布于 2024-08-29 01:46:46 字数 174 浏览 2 评论 0原文

调用 MyPanel.Panel1.Hide();或 MyPanel.Panel2.Hide();只是将控件隐藏在面板内部...但我想让面板的另一侧填满整个空间。

因此,如果我隐藏 Panel1,我希望 Panel2 占据整个空间,并且我希望分离器消失。这可能吗?如果可以,怎么做?

Calling MyPanel.Panel1.Hide(); or MyPanel.Panel2.Hide(); simply hides the controls inside the panel... but I want to have the other side of the panel fill up the whole space.

So, if I hide Panel1, I want Panel2 to take up the whole space, and I want the splitter to disappear. Is that possible, if so, how?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

泪眸﹌ 2024-09-05 01:46:46

使用 MyPanel.Panel1Collapsed = true; 折叠 Panel1(对于 panel2 也是如此)。

Use MyPanel.Panel1Collapsed = true; to collapse Panel1 (likewise for panel2).

如梦 2024-09-05 01:46:46

要隐藏您可以调用的面板之一,

MyPanel.Panel1Collapsed = true; // or Panel2Collapsed

如果 Panel2 已折叠,它将在调用后将其状态切换为显示。

MSDN 参考< /a>

To hide one of the panels you can call

MyPanel.Panel1Collapsed = true; // or Panel2Collapsed

If Panel2 was collapsed, it will toggle its state to be shown after this call.

MSDN Reference

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