I am handling a mouse wheel event in a UserControl which inherits NumericUpDown
Private Sub MyUpDown_MouseWheel(sender As Object, e As MouseEventArgs) Handles Me.MouseWheel
Me.Value += e.Delta * Me.Increment ' / WHEEL_DELTA
End Sub
MouseEventArgs.Delta
has this tooltip:
Gets a signed count of the number of detents the mouse wheel has rotated, multiplied by the WHEEL_DELTA constant. A detent is one notch of the mouse wheel.
However I can't find this constant. It is usually 120, but I don't want to bank on usually. How can I expose it to my code?
According to MSDN Most applications should check for a positive or negative value rather than an aggregate total.
in most cases, I have only seen 1 detent movement per click - they might come in rapid succession, but 1 tick (e.Delta=120) per click.
To get the MouseWheel delata factor:
WheelDelta As Integer = SystemInformation.MouseWheelScrollDelta
it is a member of System.Windows.Forms along with all sorts of other metrics like scroll thumb width etc.
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