我想问下在MID中打开了一个子窗体A,当子窗体A在没有关闭前 再次按打开A窗体的时候,把已经打开的A窗体重新调出来,而不是再打开一个窗体A,使MID中有2个A窗体

解决方案 »

  1.   

    看看这个: 
    for (int i = 0; i   < this.MdiChildren.Length; i++)  
                {  
                    if (this.MdiChildren[i].Name == "form1")  
                    {  
                        this.MdiChildren[i].Activate();  
                        return;  
                    }  
                }  
                form1 newMDIChild = new form1();  
                newMDIChild.MdiParent = this;  
                newMDIChild.Show();
      

  2.   

               foreach (Form frm in this.MdiChildren)
                {
                    if (frm is XiaoshouChu)
                    {
                        frm.WindowState = FormWindowState.Normal;
                        frm.Activate();
                        return;
                    }            }
                XiaoshouChu xc = new XiaoshouChu();
                xc.MdiParent = this;
                xc.Show();XiaoshouChu 为子窗体