title: How to move picturebox with mouse, but with the mouse remaining on it's position?
body: <p>I had some code to move the control around, but when you reached the end of the screen you had to release your right mouse button, right click on the image again, and drag again, .. repeat..</p>
  
  <p>Now I tried to rewrite the code so the control would move without the mouse being moved. This is what I have for now:</p>
  
  <pre><code>Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
      Dim xx As String = DirectCast(e, MouseEventArgs).Button.ToString
      If xx = "Right" Then
          Dim Px As Point = New Point(Me.Location.X + SplitContainer1.Location.X + SplitContainer1.SplitterDistance + CInt((SplitContainer1.Width - SplitContainer1.SplitterDistance) / 2), Me.Location.Y + SplitContainer1.Location.Y + CInt(SplitContainer1.Height / 2))
          Windows.Forms.Cursor.Position = Px
          PictureBox1.Left = PictureBox1.Left + (e.X - Px.X)
          PictureBox1.Top = PictureBox1.Top + (e.Y - Px.Y)
      End If
  End Sub
  </code></pre>
  
  <p>However the image doesn't move, it returns to it's original position along with the mouse.</p>
  
  <p>How would I make this code move the picturebox without allowing the mouse to change position?</p>