摘要:模擬MSN的震動視窗
在一小段迴圈內亂數改變視窗左上角的位置就可以了
看程式碼
private void button1_Click(object sender, EventArgs e)
{
Point now_p = this.Location;
Random r = new Random();
for (int i = 0; i < 50; i++)
{
Point new_p = new Point(now_p.X + r.Next(-10, 10), now_p.Y + r.Next(-10, 10)); //新的位置
this.Location = new_p;
System.Threading.Thread.Sleep(20);
this.Location = now_p; //還原位置
}
}
[Code下載]
by sam319