scrollwheel mousedown event

false74

Well-known member
Joined
Aug 4, 2010
Messages
76
Programming Experience
Beginner
I have this method:
VB.NET:
    Private Sub formdrag(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gro1.MouseDown
        If e.Button = MouseButtons.Left Then
            gro1.Capture = False  'groupbox in form
            Me.Cursor = Cursors.SizeAll
            Const WM_NCLBUTTONDOWN As Integer = &HA1S
            Const HTCAPTION As Integer = 2
            Dim msg As Message = _
                Message.Create(Me.Handle, WM_NCLBUTTONDOWN, _
                    New IntPtr(HTCAPTION), IntPtr.Zero)
            Me.DefWndProc(msg)
        End If
        Me.Cursor = Cursors.Default
    End Sub

it works perfects, it alows the user to click and drag a form to move it, however i was looking to see if I can drag using the scrollwheel mousedown event (click and drag with scrollwheel)

i have tried changing the if statement to this:
VB.NET:
  If e.Button = MouseButtons.middle Then
but it doesnt work. should I not be using mousedown event for this?
 
Back
Top