本文介绍了启动画面(MetroFramework)未显示C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用了Metro框架来创建启动画面,但是当我将.Abort()
函数用于线程时,启动画面根本无法工作.但是,如果我使用.Suspend()
,它可以工作,即使在加载主窗体后,启动画面也不会处理.这是代码,
I used metro framework for create splash screen, but when i use .Abort()
function for thread then the splash screen is not working at all. But if i use .Suspend()
it's working but even after the main form load, splash screen is not disposing.Here is the code,
public Login()
{
Thread t = new Thread(new ThreadStart(loading));
t.Start();
InitializeComponent();
for(int i = 0; i <= 1000; i++)
{
Thread.Sleep(10);
t.Abort();
}
}
void loading()
{
Splash frmsplash = new Splash();Application.Run(frmsplash);
}
这是启动画面代码,
public partial class Splash : MetroFramework.Forms.MetroForm
{
public Splash()
{
InitializeComponent();
}
}
推荐答案
我找到了一个解决方案,但不知道它是否对每个人都适用,我只是将t.Abort()
放在for循环之外,它确实对我有用
I found a solution but do not know whether it'll work for every one, I just put t.Abort()
outside the for loop, it does work for me.
这篇关于启动画面(MetroFramework)未显示C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!