Find the velocity of the mouse in C#

前端 未结 4 1838
攒了一身酷
攒了一身酷 2020-12-19 08:35

How can i find the instantaneous vertical speed of the mouse at the exact moment that the mouse is released? i have the users dragging over a custo

4条回答
  •  悲哀的现实
    2020-12-19 09:02

    Consider pinvoking GetMouseMovePointsEx(). It can give you move history for up to 64 points. Each point has a time stamp, allowing you to accurately calculate speed. It gets you much more accuracy since the time stamp is not affected by any delays you may get from having the mouse move messages buffered in the message queue. And you can get points in native mouse units instead of pixels. Visit pinvoke.net for the declarations.

提交回复
热议问题