VB.NET - Mouse Coordinates

后端 未结 3 790
春和景丽
春和景丽 2021-01-24 16:52

I have a vb.net application, and I want to know how to find the coordinates of the pointer (mouse) when it is clicked on the form. Not much else to say, so I\'ll leave it like t

3条回答
  •  爱一瞬间的悲伤
    2021-01-24 17:25

    Very simple code to put the mouse coords in a text box

    Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
        Dim MPx As Point = MousePosition()
        TextBox1.Text = MPx.ToString
    
    End Sub
    

    tried and tested,

提交回复
热议问题