//此代码要写在Timer里.已测试好使,你可以把Timer的触发时间设置为2秒看一下效果.
private void timer1_Tick(object sender, EventArgs e)
{
this.Location = new Point(this.Location.X + 10, this.Location.Y);
Thread.Sleep(50);
this.Location = new Point(this.Location.X - 10, this.Location.Y);
Thread.Sleep(50);
this.Location = new Point(this.Location.X + 10, this.Location.Y);
Thread.Sleep(50);
this.Location = new Point(this.Location.X - 10, this.Location.Y);
Thread.Sleep(50);
this.Location = new Point(this.Location.X + 5, this.Location.Y);
}
前面的命名空间要加什么吗,运行不来啊,或者你把什么命名的是 new point
using System.Threading;