.

解决方案 »

  1.   

    在新建的同时调用close()方法不行?
      

  2.   


    Form1 frm=new Form1();
    frm.Show();
    this.Close(); 
    //this.Visible=false; //也可以隐藏不可见
      

  3.   

    Form1 frm=new Form1();
    frm.Show();
    this.Close(); //这个方法有点问题 如果当前页面是主页面的话 那么Close()就会导致整个软件关闭
    this.Hide(); //这个方法可以直接隐藏掉该窗口
      

  4.   

    主窗体只能Hide()掉,不能Close()的说
      

  5.   

        static class Program
        {
            private static Form frm;
            public static Form frmNext;
            /// <summary>
            /// 应用程序的主入口点。
            /// </summary>
            [STAThread]
            static void Main()
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                frm = new Form1();
                while (frm != null)
                {
                    Application.Run(frm);
                    int nLayer = GC.GetGeneration(frm);
                    GC.Collect(nLayer);
                    frm = frmNext;
                    frmNext = null;
                } 
            }
        }调用的时候: Program.frmNext = new Form2();
      

  6.   

    用自定义事件,该事件在新打开的窗体的formload时触发,在原窗体中响应该事件,并关掉自身。
      

  7.   

    Form2 f2=new Form2();
    f2.visible=true;
    this.visible=false;
      

  8.   

    如果你要关闭的是程序主窗口的话,只能用this.Hide();
    其他的都可以用Close();
      

  9.   

                        fmain f = new fmain();
                                 f.Show();
                                 this.Hide();
      

  10.   


    如果 this 是主窗体,主窗体关闭后,消息循环停止、应用程序就会退出了。可是使用 隐藏窗体 的方法。