小编rs.*_*rs.的帖子

以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);
}
Run Code Online (Sandbox Code Playgroud)

但代码只是贯穿并显示结束位置而没有显示形式滑动,这就是我想要的.我尝试过Refresh,DoEvents - 任何想法?

c# loops winforms

4
推荐指数
1
解决办法
1525
查看次数

标签 统计

c# ×1

loops ×1

winforms ×1