private void btn_Click(object sender,EventArgs e)
{
Random ran=new Random();
//保存当前窗体位置
Point oldPoint = this.Location;
for (int i = 0; i < 35; i++)
{
//随机生成新的位置
Point newPoint=new Point(oldPoint.X+ran.Next(-80,80),oldPoint.Y+ran.Next(-80,80));
//将位置设置给窗体
this.Location = newPoint;
Thread.Sleep(50);
this.Location = oldPoint;
//休息50毫秒
Thread.Sleep(50);
}
}