本文介绍了如何在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.
推荐答案
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表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!