Tryvb Code:
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function ReleaseCapture Lib "user32" () As Long Private Declare Function GetCapture Lib "user32" () As Long Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If (X < 0) Or (Y < 0) Or (X > Picture1.Width) Or (Y > Picture1.Height) Then ReleaseCapture 'the mouse is no longer over the picture box, so do whatever ElseIf GetCapture() <> Picture1.hwnd Then SetCapture Picture1.hwnd 'the mouse is over the picture box, so do whatever End If End Sub




Reply With Quote