I have a Picturebox on my Form that I'd like to be able to drag left and right but to only go so far (limitations). I have set the left limitation to 2400 and the right to 6000. It drags fine, but once it reaches the limitations, it doesn't stop. Here is my code:

Code:
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static lx As Single, ly As Single
If Button = vbLeftButton Then
    If (Picture1.Left > 2399) And (Picture1.Left < 6001) Then
        Picture1.Left = Picture1.Left + (X - lx)
    Else
        If Picture1.Left < 2400 Then Picture1.Left = 2400
        If Picture1.Left > 6000 Then Picture1.Left = 6000
    End If
Else
    lx = X: ly = Y
End If
End Sub
It works, but when it gets to the left and right limitations, it does this:
Name:  drag.jpg
Views: 344
Size:  2.7 KB

It also randomly continues past the limitations. Anyway to correct this?