Option Explicit Dim Bool As Boolean Dim XX As Integer Dim YY As Integer Private Sub Picture2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Bool = True XX X: YY Y End Sub Private Sub Picture2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim dx As Integer Dim dy As Integer Dim z As Integer If Bool = True Then dx X - XX: dy Y - YY z = Picture2.Left + dx If z < 1 And z > (Picture1.Width - Picture2.Width) Then Picture2.Left = z z = Picture2.Top + dy If z < 1 And z > (Picture1.Height - Picture2.Height) Then Picture2.Top = z End If End Sub Private Sub Picture2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Bool = False End Sub