zoukankan      html  css  js  c++  java
  • 【转】WinForm中添加闪屏窗口的两种方法

    闪屏实际上是一个BorderStyle为none的窗口

    方法一:

    添加闪屏窗口并设置相应的样式属性(注意把icon显示属性去掉),添加timer控件和如下的事件函数

            private void frmSplash_Load(object sender, EventArgs e)
            {
                this.timer1.Start();
                this.timer1.Interval = 3000;
            }

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

            private void frmSplash_FormClosing(object sender, FormClosingEventArgs e)
            {
                this.timer1.Stop();
            }

    方法二:

            private void FormMain_Load(object sender, EventArgs e)
            {         

                frmSplash myFrmSplash = new frmSplash();
                myFrmSplash.Show();//不能用ShowDialog
                 Thread.Sleep(2000);//显示时间
                myFrmSplash.Close();

            }

    -------------------------------------------方法二更完善的界面:
       frmSplash myFrmSplash = new frmSplash();
       myFrmSplash.Show();
       myFrmSplash.Update();
       for (int i = 0; i <= 100; i++)

    {
         myFrmSplash.pbCount.Value = i;
         myFrmSplash.lbl2.Text = i.ToString() + "%";
         myFrmSplash.Update();
         Thread.Sleep(10);
       }
       myFrmSplash.Close();

    -------------------------------------------

  • 相关阅读:
    Redis操作命令大全
    Redis实用监控工具一览
    Redis缓存雪崩、缓存穿透、缓存击穿、缓存降级、缓存预热、缓存更新
    Redis GEO地理位置信息,查看附近的人
    详解redis持久化
    详解Supervisor进程守护监控
    详解Redis Cluster集群
    arduino使用rfid
    树莓派控制WS2812
    Arduino读取温湿度dh11+烟雾气体MQ2+彩灯ws2812
  • 原文地址:https://www.cnblogs.com/lcxu2/p/2004071.html
Copyright © 2011-2022 走看看