在一个C# Windows窗体应用程序中,我有一个带有一些多线程进程在后台运行的启动画面。我想做的是当我最初显示启动画面时,我想让它看起来像是“淡入”。然后,一旦所有进程完成,我想让它看起来像是启动画面正在“淡出”。我正在使用C#和.NET 2.0。谢谢。
使用不透明度属性时,必须记住它的类型是double,其中1.0表示完全不透明,而0.0表示完全透明。
private void fadeTimer_Tick(object sender, EventArgs e)
{
this.Opacity -= 0.01;
if (this.Opacity <= 0)
{
this.Close();
}
}
While(this.Opacity !=0)
{
this.Opacity -= 0.05;
Thread.Sleep(50);//This is for the speed of the opacity... and will let the form redraw
}