NewC c;
foreach(Form f in this.mdichindren)
{
if(f is NewC)
{
c=f;
f.show
}
}
if(c==null)
{
c.Show();
c.mdi~~=this;}
好象是这样,.就这个思路。
代码手写的,错误多多要对主窗口的菜单项进行设置,可以做为参数传到子窗体

解决方案 »

  1.   

    NewC c;
    foreach(Form f in this.mdichindren)
    {
    if(f is NewC)
    {
    c=f;
    f.show
    }
    }
    if(c==null)
    {
    c=new NewC ();
    c.Show();
    c.mdi~~=this;}
      

  2.   

    在窗口中加入静态的属性(此方法适用于任何窗口):
    private static bool mExited = true; // 窗口是否已退出, true 已退出, false 未退出
    public static bool Exited
    {
       get { return mExited; } // 只读属性
    }在 Load 事件中加入:    mExited = false;
    在 Closed 事件中加入:  mExited = true;调用:if(Form1.Exited) new Form1().Show();
      

  3.   

    BadCard form=null;
    foreach(Form f in this.MdiChildren)
    {
    if(f is BadCard)
    {
    form=(BadCard)f;
    break; }
    }
    if(form!=null)
    {
    form.Show();
    form.WindowState=FormWindowState.Maximized;
    }
    else
    {
    form=new BadCard();
    form.MdiParent=this;
    form.Show();
    }