How do I build a splash screen into a Windows Forms application without setting timers etc?

后端 未结 1 901
轮回少年
轮回少年 2020-12-18 09:17

I want to show a splash screen while my application\'s main form is loading and the splash form should disappear without me having to build in timers etc. Another important

1条回答
  •  一整个雨季
    2020-12-18 09:43

    using Microsoft.VisualBasic.ApplicationServices;
    
    public class Startup : WindowsFormsApplicationBase
    {
        protected override void OnCreateSplashScreen()
        {
            SplashScreen = new SplashForm();
        }
    
        protected override void OnCreateMainForm()
        {
            MainForm = new MyMainForm();
        }
    }
    
    static class Program
    {
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            new Startup().Run(args);
        }
    }
    

    0 讨论(0)
提交回复
热议问题