MDI winfrom 如何实现点击一按钮打开一窗口同时关闭前面打开的窗口呢?

解决方案 »

  1.   


            private void button1_Click(object sender, EventArgs e)
            {
                Control parentForm = this.Parent;
                //Form1 f1 = new Form1();
                //f1.IsMdiContainer = true;
                childChild cc = new childChild();
                cc.TopLevel = false;
                cc.Parent = parentForm;
                cc.Show();
                this.Close();
            }
      

  2.   

    估计MDI容器他已经弄好了。所以...        public Form1()
            {
                InitializeComponent();
                this.IsMdiContainer = true;
                mdiChild mc = new mdiChild();
                mc.TopLevel = false;
                mc.Parent = this;
                mc.Show();
            }