MDIchild 窗体位于面板后面

发布于 2024-10-21 10:27:19 字数 186 浏览 4 评论 0原文

我有一个 MDI 窗体的面板,面板中有一些控件。 当我打开 MDIChild 表单时,表单位于面板后面。 我尝试了 forms.BringtoFront() 和 panel.SendtoBack()。但没有任何效果。 然后我将面板的setchildIndex设置为0,也不起作用。

有没有办法让面板始终位于所有表单后面?

谢谢

I have a panel in a MDI form and there are some controls in the panel.
When I open MDIChild forms, the forms go behind the panel.
I tried forms.BringtoFront() and panel.SendtoBack().But nothing works.
Then I set setchildIndex of panel to 0,didn't work too.

Is there any way to keep the panel always behind all the forms ?

Thanks

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

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

发布评论

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

评论(5

情绪操控生活 2024-10-28 10:27:20

问题在于 MDI 子项的容器是面板的同级容器。该面板位于该容器的顶部或后面。

您希望面板与 MDI 子项位于同一个容器中,但我认为这是不可能的。 MDI 容器包含 MDI 子项,仅包含其他内容。

简而言之,我认为 MDI 不会满足您的需求。

The problem is that the container for the the MDI children is a sibling of the panel. The panel is either on top of that container or behind it.

You want the panel to be in the same container as the MDI children, but I don't believe that to be possible. The MDI container holds MDI children and nothing else.

In short, I don't think MDI is going to give you what you need.

旧伤还要旧人安 2024-10-28 10:27:20

创建一个新的空表单,然后在 Form_load 事件中设置该表单的以下属性

private void bg_Load(object sender, EventArgs e)
{
    this.ControlBox = false;
    this.FormBorderStyle = FormBorderStyle.None;
    this.WindowState = FormWindowState.Maximized;
}

,然后在 MDI 表单加载事件中编写以下代码

private void Main_Load(object sender, EventArgs e)
{
    bg bg = new bg(); // create object of empty form my empty form name is "bg"
    bg.MdiParent = this;
    bg.Show();
}

,无论您想要在后台添加到空表单中...

Create a new empty form and then set following property of this form in the Form_load event

private void bg_Load(object sender, EventArgs e)
{
    this.ControlBox = false;
    this.FormBorderStyle = FormBorderStyle.None;
    this.WindowState = FormWindowState.Maximized;
}

then after, write the following code in the MDI form load event

private void Main_Load(object sender, EventArgs e)
{
    bg bg = new bg(); // create object of empty form my empty form name is "bg"
    bg.MdiParent = this;
    bg.Show();
}

whatever you want in the background, add into empty form....

淡淡離愁欲言轉身 2024-10-28 10:27:20

您能否将面板放入 MDI 子窗口中并在 MDI 父窗口中固定其位置和大小?然后,只需在 MDI 父窗口中一次只能打开一种类型的包含面板的 MDI 子窗口即可。

Could you put the panel into an MDI child window and fix its position and size within the MDI parent? Then just make it so that only one type of MDI child window that contains your panel can be opened at a time within your MDI parent.

高跟鞋的旋律 2024-10-28 10:27:20

我刚刚在 Show 方法之后添加了 BringToFront 方法。

对我来说效果很好。

I just added the BringToFront method after the Show method.

works fine for me.

微凉徒眸意 2024-10-28 10:27:20

放置一个 flowlayout 容器,将子元素添加到其中,它将位于其他面板的顶部

Place a flowlayout container add the child to it and it will be on the top of other panel

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