Splash Screen waiting until thread finishes

前端 未结 5 831
醉梦人生
醉梦人生 2020-11-22 07:46

I still have a problem with the splash screen. I don\'t want to use the property SC.TopMost=true.

Now my application scenario is as follows:

5条回答
  •  半阙折子戏
    2020-11-22 08:06

    Unfortunately I don't have enough reputation to comment on someones answer yet. :( This is meant to be the answer to Colonel Panics comment on Hans Passants answer.

    His problem was that a MessageBox shown from new FormMain(args)will be shown behind the splash screen. The key is to invoke the MessageBox from the thread the splash screen runs in:

    splashScreen.Invoke(new Action(() => {
        MessageBox.Show(splashScreen, "the message");
    }));
    

    Where splashScreen is a reference to the splash screen object that has been created in OnCreateSplashScreen and obviously has to be given to the new Form1 object.

提交回复
热议问题