ad esempio con una Label posta su un Form:
codice:
'nella sezione dichiarazioni
Dim StartX As Integer, StartY As Integer, Moving As Boolean
'_________________________________________________________
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button <> 1 Then Exit Sub
StartX = X
StartY = Y
Moving = True
Label1.BorderStyle = 1
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Not Moving Then Exit Sub
With Label1
.Move .Left + (X - StartX), .Top + (Y - StartY)
End With
End Sub
Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Moving = False
Label1.BorderStyle = 0
End Sub
Boolean