'変数の明示的な宣言を強制します。
Option Explicit
Dim TmpX As Single
Dim TmpY As Single
Private Sub Picture1_MouseDown(Button
As Integer, Shift As Integer, X As Single, Y As Single)
'コントロール(ピクチャーボックス)上でマウスの左ボタンが押下された位置を変数に保存します。
If Button = vbLeftButton Then
TmpX = X
TmpY = Y
End If
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer,
X As Single, Y As Single)
'マウスのX、Y座標上の移動量をピクチャーボックスのLeft、Topプロパティに加え、ピクチャーボックスの新たなLeft、Topプロパティに設定します。
If Button And vbLeftButton Then
With Picture1
.Left = .Left + (X - TmpX)
.Top = .Top + (Y - TmpY)
End With
End If
End Sub