C#一个渐变并且消失的窗体
2009-07-17 11:00
176 查看
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.timer1.Enabled = true;//获取当前运行时间
this.Opacity = 1;//获取当前窗体的透明度级别;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (this.Opacity >0.9)
{
this.Opacity = this.Opacity -0.01;//窗体以0.01的速度渐变
}
else if (this.Opacity < 0)
{
this.timer1.Enabled = false;//时间为false
}
else
{
Close();///渐变消失
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.timer1.Enabled = true;//获取当前运行时间
this.Opacity = 1;//获取当前窗体的透明度级别;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (this.Opacity >0.9)
{
this.Opacity = this.Opacity -0.01;//窗体以0.01的速度渐变
}
else if (this.Opacity < 0)
{
this.timer1.Enabled = false;//时间为false
}
else
{
Close();///渐变消失
}
}
}
}
相关文章推荐
- C#一个渐变并且消失的窗体
- C# WinForm 单例模式(例:同一个窗体只创建一次实例)
- C#在后台注册一个脚本,打开一个子窗口,显示在屏幕中间,关闭子窗体刷新子窗体代码
- c# asp.net 给一个图片打上水印,并且上传
- 代码实现从我的主窗体里打开另外一个应用程序,并且让该程序像自己的MDI子窗体那样在父窗体的范围内显示
- c# 关于启动一个等待MASK窗体盖住主窗体,任务完成后,关掉MASK窗体的总结
- C#的WINFORM登录窗体中,验证码的一个方法整理。
- c#中把一个控件从一个窗体移到另一个窗体
- (转) c#中如何设计一个窗体关闭,另一个窗体打开?
- c# 在打开一个窗体的同时关闭本窗体(以vs2005为例)
- 用C#如何遍历一个窗体中的某一种控件
- C# TrackBar 控件调节 窗体透明度及颜色渐变
- C#之WinForm基础 设置某一个窗体为MDI的父窗体
- C#用DesignSurface实现一个简单的窗体设计器
- C# 一个MDI窗体怎样在加载子窗体时,使子窗体为最大化(转)
- c#中怎样在打开一个form后让第二个form出现一段时间后自动消失
- C#怎么怎么添加一个现有窗体到工程中
- C# 在一个窗体中调用另一个窗体的控件可能出现的问题
- c#做一个登陆窗体与Sql Server后台数据库连接
- [Gabriel的专栏] 用C#如何遍历一个窗体中的某一种控件