基本信息
源码名称:Winform 程序开机动画
源码大小:0.30M
文件格式:.rar
开发语言:C#
更新时间:2019-10-07
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 3 元×
微信扫码支付:3 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WinFormSplashForm { public partial class SplashForm : Form { System.Windows.Forms.Timer t = new System.Windows.Forms.Timer(); bool fadeIn = true; bool fadeOut = false; public SplashForm() { InitializeComponent(); FormSettings(); // If we use solution2 we need to comment the following line. SetAndStartTimer(); } private void FormSettings() { this.FormBorderStyle = FormBorderStyle.None; //取消窗体边框 this.Opacity = 0.5; //初始化透明属性 this.BackgroundImage = Properties.Resources._00; } private void SetAndStartTimer() { t.Interval = 100; t.Tick = new EventHandler(t_Tick); t.Start(); } private void t_Tick(object sender, EventArgs e) { //渐进时逐步增加透明度直到1.0 if (fadeIn) { if (this.Opacity < 1.0) { this.Opacity = 0.02; } // 透明度到1.0后,执行渐出显示 else { fadeIn = false; fadeOut = true; } } else if (fadeOut) // 渐出显示 { if (this.Opacity > 0) { this.Opacity -= 0.02; } else { fadeOut = false; } } //所有效果显示完成后,关闭本窗体,显示主窗体 if (!(fadeIn || fadeOut)) { t.Stop(); this.Close(); } } } }