淡入淡出启动画面

发布于 2024-07-06 04:18:48 字数 147 浏览 8 评论 0原文

在 C# Windows 窗体应用程序中。 我有一个启动屏幕,其中有一些在后台发生的多线程进程。 我想做的是,当我最初显示启动屏幕时,我希望它看起来“淡入”。 然后,一旦所有进程完成,我希望它看起来好像启动屏幕“淡出”。 我正在使用 C# 和 .NET 2.0。 谢谢。

In a C# windows forms application. I have a splash screen with some multi-threaded processes happening in the background. What I would like to do is when I display the splash screen initially, I would like to have it appear to "fade in". And then, once all the processes finish, I would like it to appear as though the splash screen is "fading out". I'm using C# and .NET 2.0. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

情话已封尘 2024-07-13 04:18:48

您可以使用计时器来修改 表单.不透明度级别

You could use a timer to modify the Form.Opacity level.

橘寄 2024-07-13 04:18:48

您可以使用窗体的不透明度属性来更改淡入度(0.0 到 1.0 之间)。

You can use the Opacity property for the form to alter the fade (between 0.0 and 1.0).

染墨丶若流云 2024-07-13 04:18:48

使用 Opacity 属性时必须记住它的类型为 double,其中 1.0 是完全不透明度,0.0 是完全透明。

   private void fadeTimer_Tick(object sender, EventArgs e)
    {
        this.Opacity -= 0.01;

        if (this.Opacity <= 0)
        {
            this.Close();
        }            
    }

When using Opacity property have to remember that its of type double, where 1.0 is complete opacity, and 0.0 is completely transparency.

   private void fadeTimer_Tick(object sender, EventArgs e)
    {
        this.Opacity -= 0.01;

        if (this.Opacity <= 0)
        {
            this.Close();
        }            
    }
说不完的你爱 2024-07-13 04:18:48
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
}
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
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文