MouseWheel, determining up and down scrolling events
events, handler, mousewheel, vb.net
Solution
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
Problem
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