Fade splash screen in and out

后端 未结 4 475
失恋的感觉
失恋的感觉 2021-01-19 14:43

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 splas

4条回答
  •  北恋
    北恋 (楼主)
    2021-01-19 15:20

    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();
            }            
        }
    

提交回复
热议问题