主程序代码
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完全透明
}
}
}