原理:间隔一定时间,改变窗体的位置,必须是围绕起始位置改变窗体位置,否则就成窗体移动了

 

 

代码
private void button1_Click(object sender, EventArgs e)
{
Random ran
= new Random((int)DateTime.Now.Ticks);
Point point
= this.Location;
for (int i = 0; i < 40; i++)
{
this.Location = new Point(point.X + ran.Next(8) - 4, point.Y + ran.Next(8) - 4);
System.Threading.Thread.Sleep(
15);
this.Location = point;
System.Threading.Thread.Sleep(
15);
}

}

 http://blog.csdn.net/jianuMan/archive/2010/06/18/5678912.aspx

相关文章:

  • 2022-12-23
  • 2021-06-15
  • 2022-02-18
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
  • 2021-10-02
猜你喜欢
  • 2022-12-23
  • 2022-01-23
  • 2021-07-02
  • 2019-09-22
  • 2021-08-01
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案