简体   繁体   English

MDI父级中的面板在最大化时被子级重叠

[英]Panel in MDI Parent overlapped by child when maximized

I'm writing a windows application using VS2010 and C# 4.0. 我正在使用VS2010和C#4.0编写Windows应用程序。 I have a MDI Parent form, and I need to have a "settings panel" at the bottom of it. 我有一个MDI父窗体,并且在它的底部需要有一个“设置面板”。 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. 我的设置面板应始终可见,并且不得与其他任何物体重叠。

Do not use a Form for this. 请勿为此使用Form You should be using a simple Panel . 您应该使用一个简单的Panel Follow these simple steps: 请遵循以下简单步骤:

  1. Set your main form's IsMdiContainer to false . 将主窗体的IsMdiContainerfalse
  2. Add a Panel to your main Form and dock it to the bottom (or whatever option you prefer, left, right, etc.). Panel添加到您的主Form并将其停靠在底部(或您喜欢的任何选项,向左,向右等)。 This pannel will be your settings panel. 该面板将成为您的设置面板。
  3. Set your main form's IsMdiContainer back to true . 将主窗体的IsMdiContainertrue
  4. Add all relevant controls to your settings panel which will always be visible. 将所有相关控件添加到设置面板中,该控件将始终可见。

Steps 3 and 4 can be done in any order. 步骤3和4可以按任何顺序进行。

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 ). 首先将IsMdiContainer设置为false的原因是确保可以将Panel停靠在Form的客户端空间内,而不是停靠在MdiContainer控件的客户端空间内(当您将IsMdiContainer设置为true时,设计器会自动添加它)它的对接设置为Fill )。 If you were to dock it inside the MdiContainer the Panel would be hidden by any MdiChild you were to open. 如果要将其停靠在MdiContainerPanel将被您要打开的任何MdiChild隐藏。 Note that you can not interact directly with the MdiContainer control in the designer. 请注意,您不能直接与设计器中的MdiContainer控件进行交互。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM