制作 windows应用程序的启动面板

来源:互联网 发布:经融一体机软件 编辑:程序博客网 时间:2024/05/22 00:49

主程序代码

public partial class frmMain : Form

{

          public frmMain()
        {
               m_frmStart = new FrmStart();
               m_frmStart.Show();
               this.m_frmStart.Invalidate();
               Application.DoEvents();
        } 

}


FrmStart启动程序代码
public partial class FrmStart : Form
    {
        //private bool hasError; // 是否有错
      
        public FrmStart()
        {
            InitializeComponent();
            this.timer1.Start();
        }
       
   
        /// <summary>
        /// 设置启动界面的信息
        /// </summary>
        /// <param name="message">要显示的信息</param>
        public void SetText(string strText)
        {
            this.lblText.Text = strText;
            this.Invalidate();
            Application.DoEvents();
        }

        private void FrmStart_Load(object sender, EventArgs e)
        {
           
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (this.Opacity < 1)
            {
                this.Opacity += 0.05;
                this.Refresh();               
            }
            else
            {
                this.Opacity = 1;//1完全不透明,0完全透明
            }
        }
    }

原创粉丝点击