你可以做一个
闪屏窗口
像 Microsoft Visual Studio .NET 2003
具体代码片断
[STAThread]
public static void Main()
{
_MainForm= new MainForm();
//主窗口传递给闪屏 窗口
FlashScreenFrm fs = new FlashScreenFrm(_MainForm);
//闪屏模式显示
if (fs.ShowDialog()==DialogResult.Cancel)
{
System.Environment.Exit(1);
}
//完成后销毁
fs.Dispose();
try
{
//启动主窗口
Application.Run(_MainForm);
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
System.Environment.Exit(1);
}
finally
{
}
}
//闪屏窗口
///窗口为平板样式
public class FlashScreenFrm : System.Windows.Forms.Form
{
//显示消息
private System.Windows.Forms.Label label1;
private System.ComponentModel.IContainer components=null;
//时间控件
private System.Windows.Forms.Timer timer1;
//放置图形
private System.Windows.Forms.PictureBox pictureBox1;
MainForm _mForm;
//构造1
public FlashScreenFrm()
{
InitializeComponent();
}
//构造2
public FlashScreenFrm(MainForm mForm):this()
{
//有用
this.Tag=0;
//保留变量
_mForm = mForm;
//设置消息
label1.Text= "程序初始化";
//启动 timer1 如果在这里写处理什么也看不到
timer1.Enabled=true;
}
//省略部分。。。。。。。
private void FlashScreenFrm_Closing(object sender
, System.ComponentModel.CancelEventArgs e)
{
//防止 alt+F4
if ((int)this.Tag==0)
e.Cancel=true;
}
private void timer1_Tick(object sender, System.EventArgs e)
{
DialogResult rVar =DialogResult.Cancel;
//就运行一次
timer1.Enabled=false;
this.label1.Text="程序正在加载请稍后";
//不加这个就看不到效果
Application.DoEvents();
try
{
//调用主窗口的计算函数
_mForm.LoadIClients();
this.label1.Text="程序加载完成....";
Application.DoEvents();
//不加这个最后的消息看不见
System.Threading.Thread.Sleep(100);
rVar =DialogResult.OK;
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
this.Tag = 1;
this.DialogResult = rVar;
}
}
}