最大化时,MDI 父级中的面板与子级重叠

发布于 2024-12-27 10:30:12 字数 163 浏览 4 评论 0原文

我正在使用 VS2010 和 C# 4.0 编写一个 Windows 应用程序。我有一个 MDI 父窗体,我需要在其底部有一个“设置面板”。为此,我使用了无边框表单。但是现在,当应用程序运行时,当我最大化子窗体时,它会与设置面板重叠。我怎样才能避免这种情况?我的设置面板应该始终可见,并且不会与其他任何内容重叠。

I'm writing a windows application using VS2010 and C# 4.0. I have a MDI Parent form, and I need to have a "settings panel" at the bottom of it. I used a borderless form for this purpose. But now while the application is running, when I maximize a child form it overlaps the settings panel. How can I avoid that? My settings panel should always be visible and never overlapped by anything else.

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

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

发布评论

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

评论(1

Spring初心 2025-01-03 10:30:12

不要为此使用Form。您应该使用一个简单的Panel。请按照以下简单步骤操作:

  1. 将主窗体的 IsMdiContainer 设置为 false
  2. Panel 添加到您的主 Form 并将其停靠在底部(或您喜欢的任何选项,左侧、右侧等)。该面板将是您的设置面板。
  3. 将主表单的 IsMdiContainer 设置回 true
  4. 将所有相关控件添加到您的设置面板中,该面板将始终可见。

步骤 3 和 4 可以按任意顺序完成。

首先将 IsMdiContainer 设置为 false 的原因是为了确保您可以将 Panel 停靠在 Form< 的客户端空间内/code> 而不是 MdiContainer 控件的内部客户端空间(当您将 IsMdiContainer 设置为 true 时,设计器会自动添加它对接设置为填充)。如果您要将其停靠在 MdiContainer 内,则 Panel 将被您要打开的任何 MdiChild 隐藏。请注意,您无法直接与设计器中的 MdiContainer 控件交互。

Do not use a Form for this. You should be using a simple Panel. Follow these simple steps:

  1. Set your main form's IsMdiContainer to false.
  2. Add a Panel to your main Form and dock it to the bottom (or whatever option you prefer, left, right, etc.). This pannel will be your settings panel.
  3. Set your main form's IsMdiContainer back to true.
  4. Add all relevant controls to your settings panel which will always be visible.

Steps 3 and 4 can be done in any order.

The reason to first set the IsMdiContainer to false is to make sure you can dock your Panel inside the client space of the Form and not to inside client space of the MdiContainer control (which is automatically added by the designer when you set IsMdiContainer to true with it's docking set to Fill). If you were to dock it inside the MdiContainer the Panel would be hidden by any MdiChild you were to open. Note that you can not interact directly with the MdiContainer control in the designer.

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