日期:2014-05-17  浏览次数:21046 次

C#winform 如何实现主窗体关闭并且要子窗体显示出来。必须关闭主窗体!谢谢!
rt,谢谢。最后关闭子窗体还是需要显示主窗体的。

------解决方案--------------------
static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
            ShowChildForm();
        }

        public static Form ChildForm;

        static void ShowChildForm()
        {
            if (ChildForm != null && (ChildForm.GetType().Name == "Form1" 
------解决方案--------------------
 ChildForm.GetType().Name == "Form2"))
            {
                Application.Run(ChildForm);
                ShowChildForm();
            }
        }
    }

大概意思吧 细节上自己处理下