I have then created a new bar which goes with the theme of my app using a rectangle shape. If have some images to close and minimize and all is well at this point.
I then came to making the window dragable via the rectangle shape, this is where the problems start
So far i have managed to get it semi working using the code below
Public Class chat Dim IsMouseDown = False Dim startPoint Private Sub TitleBar_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TitleBar.MouseUp IsMouseDown = False End Sub Private Sub TitleBar_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TitleBar.MouseDown startPoint = e.Location IsMouseDown = True End Sub Private Sub TitleBar_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TitleBar.MouseMove If IsMouseDown Then Dim p1 = New Point(e.X, e.Y) Dim p2 = PointToScreen(p1) Dim p3 = New Point(p2.X - startPoint.X, p2.Y - startPoint.Y) Location = p3 End If End Sub End Class
The problem with this code is that if the mouse is moved to fast it it tends to jump out of the area of the TitleBar and the form stops following the mouse. Is there a way to stop this happening or a better way to go about moving a form that doesn't have a title bar?