views:

379

answers:

2

Is there any way to determine if the mouse scrolls up or down using the Mousewheel handler on a sub? eg

Private Sub PictureBox1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel

if mousewheel.scrollup then UserZoom = UserZoom + 0.05 Me.Refresh() end if

End Sub

I want to be able to adjust the value of userzoom up or down according to if the mouse is wheeled up or down. Any help would be appreciated guys

A: 

Figured it out.

e.delta passes either negative or positive values according to if the mouse is scrolled up or down!

Craig
+1  A: 

Check the Delta property of the MouseEventArgs:

Sample code:

Private Sub Form1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel
    If e.Delta > 0 Then
        Trace.WriteLine("Scrolled up!")
    Else
        Trace.WriteLine("Scrolled down!")
    End If
End Sub
M.A. Hanin
Ahh, too late :-)
M.A. Hanin
Stumbled accross it! haha take the credit tho :-)
Craig