C#启动画面线程冻结

时间:2018-03-01 23:59:45

标签: c# multithreading winforms

我遇到了问题,我添加了一个启动画面。出现闪屏。但它完成后并没有消失,主表格已经加载。

static void Main()
{
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);

    Thread thread = new Thread(new ThreadStart(showSplashScreen));
    thread.IsBackground = true;
    thread.Start();
    Thread.Sleep(1000);
    Main main = new Main();
    Application.Run(main);
    thread.Abort();
}

private static void showSplashScreen()
{
    Application.Run(new SplashForm());
}

0 个答案:

没有答案