Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for WHEEL_DELTA constant

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?

like image 469
djv Avatar asked Feb 06 '14 20:02

djv


1 Answers

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.

like image 70
Ňɏssa Pøngjǣrdenlarp Avatar answered Nov 05 '22 03:11

Ňɏssa Pøngjǣrdenlarp