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

  • 相关阅读:
    在网页中实现截屏粘贴的功能
    CSS3 @font-face 做自定义图标
    Visual Studio报错一箩筐(持续更新)
    Axure实现vcg官网首页原型图
    Axure实现bootstrap首页线框图
    Web第一天——准备篇
    vue动态加载组件
    组件封装之将代码放到npm上
    node连接mysql生成接口,vue通过接口实现数据的增删改查(二)
    autoCAD2007 快捷键 标注
  • 原文地址:https://www.cnblogs.com/junjiedeng/p/3601307.html
Copyright © 2011-2022 走看看