zoukankan      html  css  js  c++  java
  • 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();
                    }
                }
            }

  • 相关阅读:
    pacx & zr(yet)
    FileInputStream RandomAccessFile FileChannel 与 MappedByteBuffer (yet)
    结合自定义注解的 spring 动态注入
    redis事务与管道区别
    jdk动态代理与cglib优势劣势以及jdk动态代理为什么要interface
    maven scope属性值设置含义
    xc (yet)
    单链表 环
    适配器模式,将老接口的数据给新接口用
    移动硬盘无法拷贝大于4G的文件
  • 原文地址:https://www.cnblogs.com/junjiedeng/p/3601307.html
Copyright © 2011-2022 走看看