WinForm 闪屏实现

其实就是新建的一个Windows窗体设置隐藏了标题栏和边框 FormBorderStyle为None

        System.Windows.Forms.Timer timer = new Timer();
        private void FrmFlashScreen_Load(object sender, EventArgs e)
        {
            time_screen.Tick += new EventHandler(time_screen_Tick);
            this.FormClosed += new FormClosedEventHandler(FrmFlashScreen_FormClosed);
            time_screen.Start();
            time_screen.Interval = 2000;

        }

        void FrmFlashScreen_FormClosed(object sender, FormClosedEventArgs e)
        {
            this.time_screen.Stop();
        }

        private void time_screen_Tick(object sender, EventArgs e)
        {
            this.Close();
        }


在主窗体中调用

            FrmFlashScreen s = new FrmFlashScreen();
            s.StartPosition = FormStartPosition.CenterScreen;
            s.ShowDialog();


 

你可能感兴趣的:(WinForm 闪屏实现)