开启线程,打开窗体

来源:互联网 发布:windows 邮件服务器 编辑:程序博客网 时间:2024/06/08 03:58
  #region 开启线程,打开窗体
        public Form form;
        public void OpenChildForm()
        {
            Thread thread = new Thread(showform);
            thread.IsBackground = false;
            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
        }
        void showform()
        {
            Application.Run(form);
        }
        #endregion