namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
System.Timers.Timer timer1;
private void timer1_Elapsed(object sender, EventArgs e)
{
CheckForIllegalCrossThreadCalls = false;
if (this.label1.Location.Y == 700)
{
this.label1.Location = new Point(100, 0);
this.timer1.Enabled = false;
}
this.label1.Location = new Point(100, this.label1.Location.Y + 1);
}
private void button1_Click(object sender, EventArgs e)
{
timer1 = new System.Timers.Timer(0.1);
this.timer1 .Elapsed +=new System.Timers.ElapsedEventHandler(timer1_Elapsed);
this.timer1.Enabled = true;
}
}
}
刚发现System.Timers的Interval属性可以设置1毫秒以下的值
但是感觉0.1毫秒触发timer1_Elapsed 跟1毫秒没区别..
[[it] 本帖最后由 yanhui387 于 2008-11-23 20:16 编辑 [/it]]