第一步: 主程序启动主窗体(这里表示为 form1)
如下:
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
第二步: 主窗体( form1) 中的 _Load 事件中启动欢迎界面 (SplashForm)
如下:
        private void Form1_Load(object sender, EventArgs e)
        {
            //启动窗体
            SplashForm MySplashForm = new SplashForm ();
            MySplashForm.ShowDialog();
        }
第三步: 欢迎界面中控制界面的显示方式并使用 timer 控制欢迎界面的消失时间 (实际中往往是读取系统需要的配置信息后消失)
如下:
        private void Form2_Load(object sender, EventArgs e)
        {
            //设置启动窗体
            this.FormBorderStyle = FormBorderStyle.None;
            this.BackgroundImage = Image.FromFile("test.jpg");
            this.timer1.Start();
            this.timer1.Interval = 10000;
        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            //...........读取系统配置

            //关闭启动窗体
            this.Close();
        }
        private void SplashForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            //关闭定时器
            this.timer1.Stop();
        }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-05
  • 2022-12-23
  • 2021-11-26
  • 2021-08-03
猜你喜欢
  • 2021-10-28
  • 2021-11-17
  • 2022-03-01
  • 2022-12-23
  • 2022-01-14
  • 2021-06-05
  • 2021-10-28
相关资源
相似解决方案