我的程序循环一次后就冻结了。
我尝试替换循环的条件,并使其无限期地循环,但是它总是做同样的事情。
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles
Button3.Click
ballX = Button2.Location.X + 1
ballY = Button2.Location.Y + 1
Dim g As Integer
Dim h As Integer
h = Button2.Location.X
Do Until h > 856
Button2.Location = New Point(ballX, ballY)
Me.Update()
Loop
End Sub
应该移动一个按钮,直到碰到程序侧面,然后停止。它所做的只是将按钮移动1px,那么您将无法再与该程序进行交互。有解决办法吗?
答案 0 :(得分:0)
您尝试过
Do Until h > 856
Button2.Location = New Point(ballX, ballY)
ballX = Button2.Location.X + 1
ballY = Button2.Location.Y + 1
h = Button2.Location.X
Me.Update()
Loop