如何制作一个带启动屏幕的窗体

需要你准备两个Winform的窗体,一个叫它:SplashScreen,把它做成一个漂亮的窗体。然后你需要一个主窗体叫它:Form1吧,然后在这个窗体加入下面的代码。

// ( C# )

protected override void OnLoad ( System.EventArgs e )

{

//make load take a long time

Thread.Sleep(2000);

base.OnLoad(e);

}

然后在Main中加入这样的代码:

[STAThread]

static void Main()

{

SplashScreen splashForm = new SplashScreen();

splashForm.Show();

Form1 mainForm = new Form1() ;

mainForm.Load += new EventHandler(splashForm.MainScreen_Load);

Application.Run(mainForm);

}

不要忘了加上对Threading的引用: using System.Threading;

Published At
Categories with Web编程
Tagged with
comments powered by Disqus