Private OldPos As Single
Private PosX As Single
Private Etat As Boolean
Private Sub CommandButton1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Etat = True
OldPos = CommandButton1.Left
PosX = X
End Sub
Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Etat = True Then
CommandButton1.Left = CommandButton1.Left + (X - PosX)
End If
End Sub
Private Sub CommandButton1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Dim Rep As Integer
Etat = False
Rep = MsgBox("Voulez-vous vraiment modifier les horaires de cette tâche?", vbYesNo + vbQuestion, "Confirmation")
If Rep = vbNo Then
CommandButton1.Left = OldPos
Else
MsgBox "Modification effectuée !", vbInformation, "Information"
End If
End Sub
Private Sub UserForm_Initialize()
Me.Width = Application.Width
Me.Height = Application.Height
Etat = False