The first step: The main program launches the main form (represented here as Form1)
As follows:
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
Step Two: Start the Welcome Interface (Form2) in the _load event in the main form (Form1)
As follows:
private void Form1_Load(object sender, EventArgs e)
{
//启动窗体
Form2 MySplashForm = new Form2();
MySplashForm.ShowDialog();
}
Step three: Welcome the Control interface display mode and use timer to control the disappearing time of the Welcome interface (it often disappears after reading the configuration information that the system needs)
As follows:
private void Form2_Load(object sender, EventArgs e)
{
//设置启动窗体
this.FormBorderStyle = FormBorderStyle.None;
this.BackgroundImage = Image.FromFile("test.jpg");
this.timer1.Start();
this.timer1.Interval = 10000;
}
private void timer1_Tick(object sender, EventArgs e)
{
//...........读取系统配置
//关闭启动窗体
this.Close();
}
private void Form2_FormClosed(object sender, FormClosedEventArgs e)
{
//关闭定时器
this.timer1.Stop();
}
Article Source: http://www.cnblogs.com/ziyiFly/archive/2008/09/11/1288812.html