"peter hansen" <wo**@tell.yo u> wrote...
By doing that I have no border I can click at to drag the form. How do I
make the form-area drag-able so that it is possible to click at a random
point at the form, hold down the mousebutton and then move the form?
This should work:
Private _MouseDown As Boolean
Private _MouseX As Integer
Private _MouseY As Integer
Private Sub Form1_MouseDown (ByVal sender As Object, _
ByVal e As System.Windows. Forms.MouseEven tArgs) Handles
MyBase.MouseDow n
_MouseDown = True
_MouseX = e.X
_MouseY = e.Y
End Sub
Private Sub Form1_MouseMove (ByVal sender As Object, _
ByVal e As System.Windows. Forms.MouseEven tArgs) Handles
MyBase.MouseMov e
If _MouseDown Then
Me.Left = Me.Left + (e.X - _MouseX)
Me.Top = Me.Top + (e.Y - _MouseY)
End If
End Sub
Private Sub Form1_MouseUp(B yVal sender As Object, _
ByVal e As System.Windows. Forms.MouseEven tArgs) Handles
MyBase.MouseUp
_MouseDown = False
End Sub