子窗体隐藏在 MDI 父容器后面
当子窗体打开时,它隐藏在 MDI 父容器的标题栏后面。
子窗体的 WindowState
设置为 Maximized
。 FormBorderStyle
设置为 None
。
如果我最小化 MDI 父窗体并最大化它,则子窗体会出现在前面。
如何克服这种情况呢?
编辑:
我使用以下代码打开子表单。
this.childForm= new ChildForm();
this.childForm.MdiParent = this;
this.WindowState = FormWindowState.Maximized;
this.childForm.Dock = DockStyle.Fill;
this.childForm.Show();
this.childForm.BringToFront();
this.childForm.Focus();
When a child form is opened it is hidden behind the title bar of MDI Parent Container.
The Child form's WindowState
is set to Maximized
. FormBorderStyle
is set to None
.
If I minimize the MDI parent and maximize it, then the child form comes in to front.
How to overcome this situation?
Edit:
I use the following code to open a child form.
this.childForm= new ChildForm();
this.childForm.MdiParent = this;
this.WindowState = FormWindowState.Maximized;
this.childForm.Dock = DockStyle.Fill;
this.childForm.Show();
this.childForm.BringToFront();
this.childForm.Focus();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试以下代码。
Try the following code.
本机 Windows MDI 实现无法处理无边框 MDI 子窗口。不幸的是,Winforms 忘记强制执行该限制。您可以在 Show() 调用之后移动 WindowState 赋值,但这会导致另一个问题。
只是不要使其无边框,无论如何边框都是不可见的。
The native Windows MDI implementation cannot deal with borderless MDI child windows. Unfortunately, Winforms forgets to enforce that restriction. You can move the WindowState assignment after the Show() call but that causes another problem.
Just don't make it borderless, the border isn't visible anyway.