需要你准备两个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;
本文介绍如何使用C#在Winform应用中实现一个启动加载界面。通过创建SplashScreen窗体并在主窗体Form1加载前显示,可以提升用户体验。文章提供具体代码示例。
1654

被折叠的 条评论
为什么被折叠?



