MDIchild 窗体位于面板后面
我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
问题在于 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.
创建一个新的空表单,然后在 Form_load 事件中设置该表单的以下属性
,然后在 MDI 表单加载事件中编写以下代码
,无论您想要在后台添加到空表单中...
Create a new empty form and then set following property of this form in the Form_load event
then after, write the following code in the MDI form load event
whatever you want in the background, add into empty form....
您能否将面板放入 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.
我刚刚在
Show
方法之后添加了BringToFront
方法。对我来说效果很好。
I just added the
BringToFront
method after theShow
method.works fine for me.
放置一个 flowlayout 容器,将子元素添加到其中,它将位于其他面板的顶部
Place a flowlayout container add the child to it and it will be on the top of other panel