Why is WheelDelta = 120?

前端 未结 4 1235
無奈伤痛
無奈伤痛 2021-02-13 21:09

I\'m working with mouse events, specifically OnMouseWheel. Many code samples refer to distance the view changes (or zoom f.i. in 3D application) as Distance =

4条回答
  •  再見小時候
    2021-02-13 21:45

    The question is marked as answered already I thought I might provide some more information.

    If I understand correctly, WHEEL_DELTA is actually 40 not 120, the 120 comes from the mouse driver multiplying the raw WHEEL_DELTA value by the number of lines to scroll, which is by default 3. You can obtain the scroll line number using

    My.Computer.Mouse.WheelScrollLines
    

    This can most easily be seen using a NumericUpDown control, which on scroll adjusts the value by the increment multiplied by that line count.

    Just messing with my wheel mouse, there are 18 detents in a full revolution, being 20 degrees per detent (Sure I know that's a small sample size of mouses in the world...!). 40 suggests they felt half degrees were fine enough though this last paragraph is supposition.

    EDIT: Not one to spread misinformation, on further study WHEEL_DELTA is in fact 120, NumericUpDown proved to be a false positive. Nonetheless, the rest of the discussion is valid, if one can apply a factor of three to the logic.

提交回复
热议问题