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
This is because mouse scroll wheel jumps up and down sometimes if the wheel speed is set up too high.
The scroll wheel at the front of the mouse is mounted on a switch mechanism that detects both how much it's rotated and whether you've pressed it (it functions like the central button of a conventional mouse). Rotations of the scroll wheel can be detected in a variety of different ways.
The onwheel event occurs when the mouse wheel is rolled up or down over an element. The onwheel event also occurs when the user scrolls or zooms in or out of an element by using a touchpad (like the "mouse" of a laptop).
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With