C# 窗体抖动

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

 

 

代码
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

posted @ 2010-06-24 13:52  孙英雄  阅读(44983)  评论(0编辑  收藏  举报