1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Option Explicit
Private Sub ObjectToMove(Sender As Object, ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
With Sender
If Shift = 2 And Button = 1 Then
.Left = .Left + X
.Top = .Top + Y
End If
End With
End Sub
Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Call ObjectToMove(CommandButton1, Button, Shift, X, Y)
End Sub
Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Call ObjectToMove(Label1, Button, Shift, X, Y)
End Sub
Private Sub OptionButton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Call ObjectToMove(OptionButton1, Button, Shift, X, Y)
End Sub |
Partager