• C#设置欢迎窗体由不透明变透明


            public Form1()
            {
                InitializeComponent();
            }

            private bool isForm1 = true;  //设置用于指示淡入淡出变化方向的变量

            private void Form1_Load(object sender, EventArgs e)
            {
                this.ClientSize = this.BackgroundImage.Size;      //设置欢迎的界面大小和背景的图片大小一致

                this.Opacity = 0;        //欢迎界面全透明

                this.timer1.Interval = 50;     //设置timer的时间间隔
                
                this.timer1.Enabled = true;     //使计时器开始运作

                this.timer1.Start();
            }

            private void timer1_Tick(object sender, EventArgs e)
            {
                if (isForm1)
                {
                    this.Opacity += 0.02;      //由不透明变成透明
                    if (this.Opacity >= 1)      //当完全不透明时再由不透明变成透明
                    {
                        isForm1 = false;
                    }
                }
                else
                {
                    this.Opacity -= 0.02;        //由透明转换为不透明
                    if (this.Opacity <= 0)        //当完全透明时停止计时器,并退出欢迎界面
                    {
                        this.timer1.Stop();
                        this.Close();
                    }
                }
            }

  • 相关阅读:
    定时器的实现
    派遣函数
    IRP的同步
    duilib基本流程
    驱动程序的同步处理
    WFP在包含fwpmu.h头的时候出错
    自己写的驱动用CreateFile打开时错误码返回1的问题
    Windows内核函数
    16_会话技术_Session
    15_会话技术_Cookie
  • 原文地址:https://www.cnblogs.com/junjiedeng/p/3601307.html
Copyright © 2020-2023  润新知