How to drag a form around the screen?

  • Thread starter Thread starter Blarneystone
  • Start date Start date
B

Blarneystone

Hi,

I am wanting to code a way to drag a form around the screen - but can't
remember how to do this in vb.net.

Can someone please post a code snippet?

Thanks
 
ooops...I found it..

For anyone who's interested:

Private MouseDownLoc As Point

Private Sub pb_T_Title_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles pb_T_Title.MouseDown
MouseDownLoc.X = e.X
MouseDownLoc.Y = e.Y
End Sub

Private Sub pb_T_Title_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles pb_T_Title.MouseMove


If e.Button = MouseButtons.Left Then
Me.Left += e.X - MouseDownLoc.X
Me.Top += e.Y - MouseDownLoc.Y
End If


End Sub
 
Blarneystone said:
Hi,

I am wanting to code a way to drag a form around the screen - but can't
remember how to do this in vb.net.

Can someone please post a code snippet?

Why would you want to do this in VB? Windows does it for you.
 
Back
Top