好的,我的表格上有一个结束事件。它里面的代码使表单淡出,然后打开另一个表单。有没有办法等到褪色完成?这是我的代码:
private void form1_closing(object sender, FormClosingEventArgs e)
{
if (this.Opacity > 0.01f)
{
e.Cancel = true;
timer1.Interval = 47;
timer1.Enabled = true;
timer1.Start();
}
else
{
timer1.Enabled = false;
}
}
private void timer2_Tick(object sender, EventArgs e)
{
progressBar1.Increment(+1);
label4.Text = progressBar1.Value.ToString() + "%";
if (progressBar1.Value == 100)
{
progressBar1.Value = 100;
timer2.Stop();
this.Close();
Form2 frm2 = new Form2();
frm2.Show();
}
}
基本上,form2 很早就打开了,我希望它在淡入淡出效果完成后等待。:)