我正在处理继承 NumericUpDown 的 UserControl 中的鼠标滚轮事件
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
有这个工具提示: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.
但是我找不到这个常数。通常是 120,但我通常不想存钱。我怎样才能将它公开给我的代码?
最佳答案
根据 MSDN Most applications should check for a positive or negative value rather than an aggregate total.
在大多数情况下,我只看到每次点击 1 次制动运动 - 它们可能会快速连续出现,但每次点击 1 滴答声(e.Delta=120)。
要获得 MouseWheel 增量因子:
WheelDelta As Integer = SystemInformation.MouseWheelScrollDelta
它是 System.Windows.Forms 的成员以及各种其他指标,如滚动拇指宽度等。
关于vb.net - 寻找 WHEEL_DELTA 常量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21613558/