Muove dinamicamente controlli



Option Explicit
Dim X1, Y1

Private Sub chkOnOff_Click()
On Error Resume Next 'resume next beacuse Not all
'controls support dragmode

Dim ctl As Control
'Turn dragmode on/off

If chkOnOff.Value Then
For Each ctl In Me.Controls
'Debug.Print TypeName(ctl)

ctl.DragMode = vbAutomatic
Next
Else
For Each ctl In Me.Controls
'Debug.Print TypeName(ctl)

ctl.DragMode = vbManual
Next
End If
Me.chkOnOff.DragMode = vbManual
End Sub

Private Sub Form_DragDrop(Source As Control, X As Single, _
Y As Single)
'Move the control

Source.Top = Y - Y1
Source.Left = X - X1
End Sub

(muovedinamicamentecontrolli.html)- by Paolo Puglisi - Modifica del 25/3/2019