这是我以前做的一个程序的Splash Form里面的,没有用进度条,这样比较简单,但也能给用户一个定性的说明,说明我们的程序没有死掉,呵呵this.label1.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(103)), ((System.Byte)(185)), ((System.Byte)(219)));
this.label1.ForeColor = System.Drawing.Color.White;
this.label1.Location = new System.Drawing.Point(211, 352);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(344, 16);
this.label1.TabIndex = 14;
this.label1.Text = "正在读取初始化信息...";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;private void timer1_Tick(object sender, System.EventArgs e)
{
this.label1.Text = this.label1.Text + ".";
if(this.label1.Text.EndsWith("......"))
{
this.label1.Text = "正在读取初始化信息";
}
}

解决方案 »

  1.   

    senkiner(金龍) 这样的话怎么才能知道后台执行完毕,并且打开后台程序呢?
      

  2.   

    bool initFinished;private void SplashForm_Load(object sender, System.EventArgs e)
    {
    initFinished = false; this.Show(); ////////////////////////////////////////////

    //初始化 //////////////////////////////////////////// initFinished = true;
    }private void timer1_Tick(object sender, System.EventArgs e)
    {
    if(initFinished == true)
    {
    this.Hide();
    this.timer1.Enabled = false;
    Global.MainForm.Show();//MainForm是你要显示的主窗体的一个实例
    return;
    } this.label1.Text = this.label1.Text + ".";
    if(this.label1.Text.EndsWith("......"))
    {
    this.label1.Text = "正在读取初始化信息";
    }
    }
      

  3.   

    用splash是个不错的方法,未必一定要有进度条,程序启动慢实际上是加载的库比较多,连接数据库本身不会花什么时间,即使是远程的。如果自己有要加载的dll或者要打开的文件,可以加载一个就在splash上提示一下。
      

  4.   

    我是如下做的:/// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main()
    {
    frmSplash splash = new frmSplash();//建立一个启动窗体
    frmMain m_theMain = new frmMain();//建立主窗体
    m_theMain.AddOwnedForm(splash);//加为子窗体以便始终显示到主窗体前面
    splash.Show();//启动窗体显示出来
    Application.DoEvents();//刷新一下
    m_theMain.SetActions(l.LoginUser);//设置主窗体的布局或权限之类的操作
    m_theMain.Show();//显示出来主窗体
    Application.DoEvents();//刷新一下
    m_theMain.LoadData();//给主窗体加载需要数据,这时启动窗体在前,主窗体在后面已显示.
    splash.Close();//主窗体加载完成,启动窗体关闭 Application.Run(m_theMain);//启动主窗体运行整个应用程序.
    }
      

  5.   

    用一个Splash窗口,等数据库连接完成后再打开主窗口就可以了
      

  6.   

    在sub main()中:
    作个splash窗体,作为一个线成显示,然后主线成加载数据,加载数据完成关闭splash线程,然后显示主窗体。
      

  7.   

    hbxtlhx(最后一片绿叶) 的方法不错
      

  8.   

    jialiang(DayAndNight) 的方法可以
      

  9.   

    我认为kangxidadi(康熙大帝) 的方法挺好的