>>(1)在fatherForm的代码区调用childF2的函数test()在fatherForm中遍历MdiChildren,判断是否为child2,是的话调用它的方法(对于动态的是这样,静态的直接调用类方法就可以)。foreach( Form f in this.MdiParent)
{
Form ff = f as child2;
if ( ff != null)
{
ff.test();
return;
}
}
{
Form ff = f as child2;
if ( ff != null)
{
ff.test();
return;
}
}
When you want to switch the Top Most MDI child, you may remove the handler and add it to another form. Here is a sample code:
private void MDI_Leave(object sender, System.EventArgs e)
{
Form mdi = (Form)sender;
if(mdi != null)
mdi.Focus();
}
//Set the event handle
TopForm.Leave += new EventHandler(this.MDI_Leave);