Mouse location (move object were is the mouse)

Simple code to demonstrate the location of cursor.

Create a form , drag in a Panel and copy the next code in code editor :




Private Sub Form1_MouseDown(sender As Object, e As MouseEventArgs) Handles_ Me.MouseDown


        If e.Button = Windows.Forms.MouseButtons.Right Then
            Panel1.Visible = True
            Panel1.Location = New Point(e.X, e.Y)
        Else
            Panel1.Visible = False
        End If


    End Sub



the Panel will apaire when the left button of mouse will be pressed.



Comments

Popular posts from this blog

How to create a rectangle

Move bordless Form

How to create a button dinamically in VB