我試着做一個迷宮。當鼠標碰到牆時,它需要返回到panel1的位置,並且它會返回,但是當我移動鼠標時,它會回到我碰到牆的地方,這個事件是無用的。我可以穿過牆壁去完成。 Video Link。Vb.net鼠標位置
Public Sub New()
InitializeComponent()
Start()
End Sub
Private Sub Start()
Dim StartPoint = Panel1.Location()
StartPoint.Offset(20, 20)
Cursor.Position = PointToScreen(StartPoint)
End Sub
Private Sub Finish_MouseEnter(sender As Object, e As EventArgs) Handles Label17.MouseEnter
MessageBox.Show("Gz")
End Sub
Private Sub WallHit_MouseEnter(sender As Object, e As EventArgs) Handles Label1.MouseEnter, Panel1.MouseEnter, Label9.MouseEnter, Label8.MouseEnter, Label7.MouseEnter, Label6.MouseEnter, Label5.MouseEnter, Label4.MouseEnter, Label3.MouseEnter, Label2.MouseEnter, Label16.MouseEnter, Label15.MouseEnter, Label14.MouseEnter, Label13.MouseEnter, Label12.MouseEnter
Start()
End Sub