F
Frank McCown
I've got a form that has no border
(FormBorderStyle.None), and I'd like to move it with the
mouse. My solution is below. Is there a better one?
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal
e As System.Windows.Forms.MouseEventArgs) Handles
MyBase.MouseDown
MouseDownLoc.X = e.X
MouseDownLoc.Y = e.Y
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal
e As System.Windows.Forms.MouseEventArgs) Handles
MyBase.MouseMove
If e.Button = MouseButtons.Left Then
Me.Left += e.X - MouseDownLoc.X
Me.Top += e.Y - MouseDownLoc.Y
End If
End Sub
(FormBorderStyle.None), and I'd like to move it with the
mouse. My solution is below. Is there a better one?
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal
e As System.Windows.Forms.MouseEventArgs) Handles
MyBase.MouseDown
MouseDownLoc.X = e.X
MouseDownLoc.Y = e.Y
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal
e As System.Windows.Forms.MouseEventArgs) Handles
MyBase.MouseMove
If e.Button = MouseButtons.Left Then
Me.Left += e.X - MouseDownLoc.X
Me.Top += e.Y - MouseDownLoc.Y
End If
End Sub