I'm trying to make a game. I have some pictures and labels on my form and what I want to be able to do is drag each label and place it in a text box next to its corresponding pictures. This is the code I have so far. What happens is that when press the left mouse button, it grabs the label and I can drag it anywhere. However, the picture is not dropped when I release the mouse button. I have to click again to drop the picture. Any ideas? How can I fix this?
Public
Class frmcattypes
Dim xd As Boolean
Public Sub frmcattypes_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
If xd = True Then
Button1.Location =
New Point(e.X, e.Y)
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
xd =
True
End Sub
Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown
xd =
True
End Sub
Thanks in advance!