如何在MDIParent控件的顶部显示MDIChild表单 [英] how to Show MDIChild Form on Top of the MDIParent's Controls

查看:61
本文介绍了如何在MDIParent控件的顶部显示MDIChild表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有许多ChildForms的MDI-Parent表单,当我想在我的Parent表单上添加一个控件时,Child表单出现在该控件下,例如,我想在MDIParent表单上添加一个groupbox和PictureBox,但是当我称它为出现在这些控件下的子窗体.

I have a MDI-Parent Form with many ChildForms, when I want to add a control on my Parent form, Child form appears under the control, For example I want to add a groupbox and a PictureBox on MDIParent Form, but when I call the Child Form it appears Under these controls.

推荐答案

您不能在MDI父控件之上显示MDI子控件-这是设计使然,是其中的一部分MDI是如何工作的.您唯一可以做的就是将控件停靠在父级的一侧或另一侧,以免它们占用屏幕空间.
MDI父控件始终绘制在每个MDI子窗体的顶部.
You can''t show MDI children on top of MDI parent controls - that is by design and is part of how MDI is meant to work. The only thing you can do is dock the controls to one side or the other of the parent so that they aren''t taking up screen real estate.
MDI parent controls are always drawn over the top of each and any MDI child forms.


private void MainModule_MdiChildActivate(object sender, EventArgs e)
{
    foreach (Form frmChild in this.MdiChildren)
    {
        if (frmChild.Visible == true)
        {
            if (frmChild.Name == "YourFormName")
            {
                mnuMainMenu.Dispose();
            }
        }
        else
        {
            this.mnuMainMenu = new System.Windows.Forms.MainMenu(this.components);
            this.Menu = mnuMainMenu;
            MainModule_Load(sender, e);
        }
    }
}



激活子窗体时,这将处理MDIParent菜单,当您关闭子窗体时,将再次出现MDIParent菜单.

希望对您有帮助.



This Will dispose your MDIParent menu when child form is activated and when you close the child form then MDIParent Menu will appear again.

Hope this will help you.


这篇关于如何在MDIParent控件的顶部显示MDIChild表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆