110,535
社区成员
发帖
与我相关
我的任务
分享
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
MessageBox.Show("Application still running"); //为什么这个不显示
for (; ;)
{
ThreadPool.QueueUserWorkItem(o => { MessageBox.Show("Form exits"); });
Thread.Sleep(1000);
}
}
}
Application.Exit();
停止UI线程上的消息循环,并关闭应用程序窗口
MessageBox.Show("Application still running")
隶属当前UI线程,所以不会弹出。