Private oldLoc As Point
Private Sub _Move(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles MyBase.Move
If Not Me.ParentForm Is Nothing Then
If Me.Left < Me.ParentForm.ClientRectangle.Left Or _
Me.Right >= Me.ParentForm.ClientRectangle.Width - 5 Or _
Me.Top < Me.ParentForm.ClientRectangle.Top Or _
Me.Bottom >= Me.ParentForm.ClientRectangle.Height - 5 Then
Me.Location = oldLoc
Else
oldLoc = Me.Location
End If
End If
End Sub
Private Sub _Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
oldLoc = Me.Location
End Sub