Hi guys, me again
I took a liberty and slightly modified original code. There may be someone else who needs this in plenty borderless forms (like me) so I moved all into module to shorten things out under form's code. This way you can handle each form like this:
Sample is attached. I hope you don't mind NickThissen, and thanks again for sharing such a nice solution !!Code:Private Sub pnlCaption_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pnlCaption.MouseDown If e.Button = Windows.Forms.MouseButtons.Left And Me.WindowState <> FormWindowState.Maximized Then MoveForm(Me) End If End Sub Private Sub pnlCaption_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pnlCaption.MouseMove If Me.WindowState = FormWindowState.Maximized Then Return SetDirection(Me) End Sub Private Sub Form1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown If e.Button = Windows.Forms.MouseButtons.Left And Me.WindowState <> FormWindowState.Maximized Then ResizeForm(Me, resizeDir(Me)) 'allow form resize and moving. End If End Sub Private Sub Form1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove If Me.WindowState = FormWindowState.Maximized Then Return SetDirection(Me) End Sub





Reply With Quote