我在屏幕的底部做一個形式,我希望它向上滑動,所以我寫了下面的代碼:中的WinForms形式滑動
int destinationX = (Screen.PrimaryScreen.WorkingArea.Width/2) - (this.Width/2);
int destinationY = Screen.PrimaryScreen.WorkingArea.Height - this.Height;
this.Location = new Point(destinationX, destinationY + this.Height);
while (this.Location != new Point(destinationX, destinationY))
{
this.Location = new Point(destinationX, this.Location.Y - 1);
System.Threading.Thread.Sleep(100);
}
但代碼只是貫穿而顯示結束而不顯示滑動的形式,而這正是我想要的。我試過刷新,DoEvents - 任何想法?
@rs:我將「Winforms」放入標題中以區別於WPF,並刪除了C#,因爲它已經存在於標記中,並且不應位於標題中。我使用了WinForms標籤,因爲這是您使用的技術。你有什麼理由反對嗎? – 2010-03-23 19:27:15