Allora ho effettuato le modifche da te riportate ma nn mi funziona, mi dice:
L'espressione su caricamento immessa come impostazione della proprietà di evento ha provocato il seguente errore: La dichiarazione della routine non corrisponde alla descrizione dell'evento o della routine con lo stesso nome.
il codice che ho usato su di una foto chiamata "img" è il seguente (in VBA)
Option Explicit
Private m_movingControl As Control
Private vShift As Single
Private hShift As Single
Private Property Set movingControl(vNewValue As Control)
Set m_movingControl = vNewValue
If vNewValue Is Nothing Then
Me.MousePointer = fmMousePointerDefault
Else
Me.MousePointer = fmMousePointerSizeAll
End If
End Property
Private Property Get movingControl() As Control
Set movingControl = m_movingControl
End Property
Private Sub HandleMouseDown(Sender As Object, ByVal X As Single, ByVal Y As Single, Optional Moveable As Boolean = True)
If movingControl Is Nothing And Moveable Then
vShift = Y
hShift = X
Set movingControl = Sender
Else
If TypeOf Sender Is Control Then
X = Sender.Left + X
Y = Sender.Top + Y
ElseIf TypeOf Sender Is UserForm Then
Else
Err.Raise 5
End If
If Not (movingControl Is Nothing) Then
movingControl.Move X - hShift, Y - vShift
Set movingControl = Nothing
End If
End If
End Sub
Private Sub img_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
HandleMouseDown img, X, Y
End Sub
Private Sub Form_MouseDown(ByVal Button As Integer, Shift As Integer, X As Single, Y As Single)
HandleMouseDown Me, X, Y, False
End Sub

Rispondi quotando