Vb.net鼠标位置

时间:2017-09-16 12:41:40

标签: vb.net location cursor mouse

我试着制作一个迷宫。当鼠标撞到墙壁时,它需要返回到panel1位置并返回,但是当我移动鼠标时它会回到我撞到墙壁的位置并且事件是无用的。我可以穿过墙完成。 Video Link

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

1 个答案:

答案 0 :(得分:0)

解决。 我在虚拟机中运行我的应用程序(Windows 10)。当我在vm中运行时出现问题,但是当我在vm外部运行时,我的应用程序正常工作。