Exemplo n.º 1
0
 private static void mainForm_Load(object sender, EventArgs e)
 {
     if (splashScreen == null)
     {
         return;
     }
     splashScreen.Invoke(new Action(splashScreen.Close));
     splashScreen.Dispose();
     splashScreen = null;
 }
Exemplo n.º 2
0
        private static void LoadWithSplash()
        {
            Application.SetCompatibleTextRenderingDefault(false);
            Application.EnableVisualStyles();

            System.Threading.Thread splashThread = new System.Threading.Thread(new System.Threading.ThreadStart(
            delegate
            {
                splashScreen = new SplashScreen();
                splashScreen.TopMost = false;
                Application.Run(splashScreen);
            }));

            splashThread.SetApartmentState(System.Threading.ApartmentState.STA);
            splashThread.Start();

            MainForm mainApplication = new MainForm();
            mainApplication.Load += new EventHandler(mainForm_Load);
            Application.Run(mainApplication);
        }