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

  • 相关阅读:
    子页面与父页面相互调用函数、元素、变量
    springboot项目多数据源及其事务
    mybatis逆向工程
    PageHelper 分页插件
    spring boot 在eclipse中打war包,及jar包
    Spring 定时任务之 @Scheduled cron表达式
    发送邮件
    spring+springmvc+hibernate 框架搭建
    MySQL驱动和数据库字符集设置不搭配
    Oracle与MySQL区别
  • 原文地址:https://www.cnblogs.com/junjiedeng/p/3601307.html
Copyright © 2011-2022 走看看