打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
【WinForm】C#编写启动欢迎界面

第一步: 主程序启动主窗体(这里表示为 form1)
如下:
    static class Program
    {
        ///
        /// 应用程序的主入口点。
        ///
        [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();
        }

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
C#中Timer控件的运用实例
C#模仿卡巴基斯渐变窗体
C# 系统加入启动窗体技巧
在Winform中使用依赖注入
c#窗体系统托盘、关闭、最小化事件
C#线程开发:winform简单的C#线程开发实例
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服