mpappert
Regular
Hey Everyone,
I'm working on creating a custom form layout (basically replace the default TitleBar with one of my own creations) .. I'm having problems with tracking mouse events ... It moves but the form moves 'jittery' and when you do a small movement and stop (not releasing the mouse button) the form still jitters until you let go of the mouse. It's also very slow ... here is my code, am I missing something?
TIA!
M.
I'm working on creating a custom form layout (basically replace the default TitleBar with one of my own creations) .. I'm having problems with tracking mouse events ... It moves but the form moves 'jittery' and when you do a small movement and stop (not releasing the mouse button) the form still jitters until you let go of the mouse. It's also very slow ... here is my code, am I missing something?
TIA!
M.
Code:
Private blnMouseDown As Boolean
Private MouseLocXonClick As Integer
Private MouseLocYonClick As Integer
Private Sub lblTitleBar_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles lblTitleBar.MouseDown
blnMouseDown = True
MouseLocXonClick = e.X
MouseLocYonClick = e.Y
End Sub
Private Sub lblTitleBar_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles lblTitleBar.MouseMove
If blnMouseDown Then
Me.Left = e.X - MouseLocXonClick
Me.Top = e.Y - MouseLocYonClick
End If
End Sub
Private Sub lblTitleBar_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles lblTitleBar.MouseUp
blnMouseDown = False
End Sub