【发布时间】:2010-03-23 19:07:55
【问题描述】:
我正在屏幕底部制作一个表单,我希望它向上滑动,所以我编写了以下代码:
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);
}
但代码只是运行并显示结束位置,而没有显示我想要的滑动形式。我尝试过 Refresh、DoEvents - 有什么想法吗?
【问题讨论】:
-
@rs:我将“Winforms”放入标题中以区别于 WPF,并删除了 C#,因为它已经在标签中,也不应该出现在标题中。我使用了 WinForms 标签,因为这是您正在使用的技术。你出于某种原因反对吗?