timer怎么不好使啊
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 Fade
{
public partial class Fade : Form
{
private bool isFade = true;
private void Fade_Load(object sender, EventArgs e)
{
this.ClientSize = this.BackgroundImage.Size;
this.Opacity = 0;
this.timer.Interval = 50;
this.timer.Enabled = true;
this.timer.Start();
}
public Fade()
{
InitializeComponent();
}
private void timer_Tick(object sender, EventArgs e)
{
if (isFade)
{
this.Opacity += 0.02;
if (this.Opacity >= 1)
{
isFade = false;
}
}
else
{
this.Opacity -= 0.02;
if (this.Opacity <= 0)
{
this.timer.Stop();
this.Close();
}
}
}
}
}
--------------------编程问答-------------------- UP一下。
应该是线程安全的问题吧。
Forms必须是单线程,必须使用基于事件的异步模式。 --------------------编程问答-------------------- 不好意思啊 是个新手 什么是up一下啊 --------------------编程问答-------------------- up --------------------编程问答-------------------- 我是新手啊 什么是up啊 麻烦了 --------------------编程问答--------------------
顶一下的意思
补充:.NET技术 , C#