Try something like this
Code:
Option Explicit

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 Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (X < 0) Or (Y < 0) Or (X > Command1.Width) Or (Y > Command1.Height) Then
       ReleaseCapture
       Command1.MousePointer = 0 'default
ElseIf GetCapture() <> Command1.hwnd Then
       SetCapture Command1.hwnd
       Command1.MousePointer = 6 'size ne sw
End If
End Sub