public class StartUpMessage
{
public StartUpMessage()
{
}
private bool _isInit = false;
//如果想关闭线程中的窗体则将IsInit设置为TRUE
public bool IsInit
{
set { _isInit = value; }
}
private void printInfo()
{
Form startFrm = new Form();
startFrm.ShowInTaskbar = false;
startFrm.TopMost = true;
startFrm.Show();
//此处安插一个循环,来处理窗体的消息,直到IsInit为TRUE,即主窗体初始化结束
while (!_isInit)
Application.DoEvents();
startFrm.Hide();
startFrm.Close();
//Application .ExitThread ();
}
/// <summary>
/// 启动一个线程,显示一个提示窗体,该窗体在父窗体初始化结束后关闭
/// </summary>
public void StartInfoFrm()
{
System.Threading.Thread startThread = new System.Threading.Thread(new System.Threading.ThreadStart(this.printInfo));
startThread.Start();
}