static void mainForm_Load(object sender, EventArgs e) { //close splash if (splashForm == null) { return; } splashForm.Invoke(new Action(splashForm.Close)); splashForm.Dispose(); splashForm = null; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //show splash Thread splashThread = new Thread(new ThreadStart( delegate { splashForm = new ss(); Application.Run(splashForm); } )); splashThread.SetApartmentState(ApartmentState.STA); splashThread.Start(); //run form - time taking operation Form1 mainForm = new Form1(); mainForm.Load += new EventHandler(mainForm_Load); Application.Run(mainForm); }