title: allow end-user to move a control
body: <p>I found a good sample <a href="https://stackoverflow.com/questions/3781245/how-to-allow-user-to-move-a-control-on-the-form/3781344#3781344">Here</a>, but I have a few problems with it.
   1. It is not placing the control to the correct position where the mouse left off becase the control is a big one.</p>
  
  <ol start="2">
  <li>It could be pushed out of the screen.. I want it should stay within the screen boundaries. </li>
  </ol>
  
  <p>This is my code:</p>
  
  <pre><code>   Public Sub Form1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyControl.MouseMove
      If Not _capturingMoves Then
          Return
      End If
      X = e.X
      Y = e.Y
  End Sub
  
  Public Sub Form1_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyControl.MouseUp
      If _capturingMoves Then
          ' Do any final placement
          MyControl.Location = New Point(X, Y)
          _capturingMoves = False
      End If
  End Sub
  </code></pre>