A B  两窗口
A窗口中:
B  b=new B();
b.show();
this.hide();
然后出显B窗口  A窗口就隐了  要在B窗口中按下按键就显示回A窗口 要怎么写???

解决方案 »

  1.   

    B  b=new B(); 
    b.Owner = this;
    b.show(); 
    this.hide(); 
    -----------------------
    A a = (A)this.Owner;
    a.Visible = true;
    a.ShowInTaskbar = true;
    this.close();
      

  2.   

    你这样使用b.ShowDialog()不更好?
      

  3.   

    A窗口中: 
    B  b=new B(); 
    b.aform =this;
    b.show(); this.hide(); 
    B窗口: 
    B窗口定义一个A类型的public 变量aform;
    private void button1_click(object Sender,EventArgs e)
    {
     this.aform.Show();
    }
      

  4.   

    这样还有一个问题就是关闭B窗口的时候,并不能退出整个程序,所以还需要设置一个变量
    然后关闭B窗口的时候,根据变量值来执行Application.Exit();就行了
      

  5.   


    在主窗口的Closed事件里面退出进程不就可以了