//Form3为要弹出的窗口调用即可,窗口添加控件timer1,timer2
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
int a =5;
double b = 0.05;
int _y = 600;
private void Form3_Load(object sender, EventArgs e)
{
this.Opacity = 0;
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
_y -= a;
this.Location = new Point(3, _y);
this.Opacity += b;
if (_y == 450)
{
timer2.Start();
timer1.Stop();
}
}
int c = 0;
int d=5;
private void timer2_Tick(object sender, EventArgs e)
{
c += d;
if (c == 100)
{
d = 0;
this.Opacity -= 0.02;
if(this.Opacity==0)
{
timer2.Stop();
timer2.Dispose();
this.Close();
}
}
}
}
转载于:https://my.oschina.net/LeoSun/blog/64344