Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form_move events, adding conditions.to mouse drag/moving.

Status
Not open for further replies.

Pearlios

Programmer
Sep 3, 2012
24
AU
Hi,

I'm looking for the piece of code that handles the dragging/moving of windows from the mouse.
I want to limit the form to be bounded within an area.

I have written the code below but want to prevent the form going out of bounds to trigger this event.

Private Sub Form2_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Move
Form1.Label1.Text = "Form screen position = " + Me.Location.ToString()

If Me.Location.X < 0 Then
Me.Left = 0
End If
End Sub

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top