这是我以前做的一个程序的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 = "正在读取初始化信息";
}
}
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 = "正在读取初始化信息";
}
}
解决方案 »
- 加粗部分出现“输入字符串的格式不正确。”请哪位高手帮忙改下~~~~~
- 有人在吗 散100分,顺便问个问题~~
- 向文件追加数据
- 如何在winfrom之间进行传值?C# 2005?
- 我想在局域网内共享音响,大家有什么好的办法?
- LibVlcAPI.libvlc_set_fullscreen设置全屏无效
- IE6,7支援css min-width與min-height問題
- 求助TCP通信中出现的未将对象引用设置到对象的实例的问题!
- 学C#途中遇到问题,请教一下高手!
- C#窗体程序运行时控件尺寸溢出窗口大小导致控件显示不完全该怎么办
- 局域网内的IP多播问题,高手请进! 50分求解!!!
- 直接调用浏览器打印控件
{
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 = "正在读取初始化信息";
}
}
/// 应用程序的主入口点。
/// </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);//启动主窗体运行整个应用程序.
}
作个splash窗体,作为一个线成显示,然后主线成加载数据,加载数据完成关闭splash线程,然后显示主窗体。