Option Explicit
Dim Started As Boolean, Copy As Boolean, StartX As Single, StartY As Single
Private Sub Box0_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Started = True: StartX = X: StartY = Y
Copy = (Shift And acCtrlMask)
If Copy Then
Box1.Top = Box0.Top
Box1.Left = Box0.Left
Box1.Width = Box0.Width
Box1.Height = Box0.Height
Box1.Visible = True
End If
End Sub
Private Sub Box0_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error Resume Next
If Started Then
If Copy Then
Box1.Left = Box0.Left + X - StartX
Box1.Top = Box0.Top + Y - StartY
Else
Box0.Left = Box0.Left + X - StartX
Box0.Top = Box0.Top + Y - StartY
End If
End If
End Sub
Private Sub Box0_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Started = False
End Sub
|