Form with custom title bar & formborderstyle = None remains draggable when maximized

Solution 1:

make:

Dim fullscreen As Boolean = False

a class variable.

Then edit this code to fit your variables:

Private Sub Mover_Tick(sender As System.Object, e As System.EventArgs) Handles Mover.Tick
    If fullscreen = false Then
         Dim pt As New Point((Me.Location.X + (MousePosition.X - mPosX)), (Me.Location.Y + (MousePosition.Y - mPosY)))
         Me.Location = pt
         mPosX = MousePosition.X
         mPosY = MousePosition.Y
    End If
End Sub

EDIT:

Also implement this:

Private Sub Title_StartDrag(sender As System.Object, e As MouseEventArgs) Handles Title.MouseDown
    mPosX = MousePosition.X
    mPosY = MousePosition.Y
    If e.Button = Windows.Forms.MouseButtons.Left Then
        Mover.Start()
    End If
End Sub

Private Sub Title_StopDrag(sender As System.Object, e As MouseEventArgs) Handles Title.MouseUp
    Mover.Stop()
End Sub

also you may want to make it much simpler by saying Me.WindowState = FormWindowState.Maximized