我有一个小问题。我做了小游戏(主窗口-地牢)和启动画面。首先创建主窗口,然后添加初始屏幕。在最初显示初始屏幕,下一个主窗口时运行我的游戏,但是如果初始屏幕关闭,则主窗口会启动,但会最小化(仅在任务栏中可见)。闪屏主窗口可见后怎么办?下面的代码主窗口。感谢您的帮助。
public Dungeons()
{
Thread thread = new Thread(new ThreadStart(SplashStart));
thread.Start();
Thread.Sleep(5000);
InitializeComponent();
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint |
ControlStyles.OptimizedDoubleBuffer, true);
player30.Visible = true;
CenterToScreen();
thread.Abort();
}
public void SplashStart()
{
Application.Run(new SplashScreen());
}
答案 0 :(得分:0)
如果要在主窗体上加载其他控件时显示启动画面,则可以使用启动画面等待。您可以参考此link
在我的应用程序中,我使用Devexpress控件SplashScreen Manager。
private void FormMain_Load(object sender, EventArgs e)
{
sphManager.ShowWaitForm();
//Place your code which you need to execute while Splash screen is active
GenerateNavigationView();
this.WindowState = FormWindowState.Maximized;
//Once you finish all your requirement, close the Splash screen
sphManager.CloseWaitForm();
}