我正在创建一个用于模拟掷骰子的小应用程序。为了模拟反弹,我随机更改图片的位置。现在为了模拟不止一次反弹,我使用了一个 for 循环来不断改变图片框的位置。但这并没有按我的计划发生,表单只显示最后一个循环的位置。我什至尝试使用System.Threading.Thread.Sleep(1000)
希望来显示反弹,但即使它们只显示最后一个循环。
For bounceCount As Integer = 1 To bounces
bounce(pb_dice1)
bounce(pb_dice2)
System.Threading.Thread.Sleep(3000) 'I need to pause here and show the recent change in position then continue after 3 seconds
Next
该bounce
方法改变了PictureBox
.
如何暂停我的 for 循环,显示新定位的骰子,然后在 3 秒后继续?