我有一个带闪屏的应用程序。当启动画面消失时,窗口会打开最大值并持续几分之一秒,然后我的应用程序返回到背景(就像它被最小化)。为什么会这样?我的表单已启用WindowState = Maximized
。
public Main()
{
//Splashscreen and new window
initializeWindow();
}
public void SplashScreen()
{
Application.Run(new SplashScreen());
}
private void initializeWindow()
{
//Start new Thread which shows Splash Screen
Thread t = new Thread(new ThreadStart(SplashScreen));
t.Start();
//Wait 3 seconds
Thread.Sleep(3000);
InitializeComponent();
//Initialize form
t.Abort();
//Abort and make main form the top form
//TopMost = true; <-- I commented this because it makes other applications not open unless if I minimize the window
}
答案 0 :(得分:2)
暂停主线程不是&#34;健康&#34;解决方案,我建议这样做:
FormClosed
事件中,打开主窗口。答案 1 :(得分:1)
请浏览此链接并编写代码以在启动画面Mdi form
活动中打开Formclosed
http://www.c-sharpcorner.com/UploadFile/1e050f/splash-screen-for-windows-form-application-C-Sharp/