Mouse move

  • Thread starter Thread starter Tomomichi Amano
  • Start date Start date
T

Tomomichi Amano

This is a addition to the question I did earlier.
What event should I use to make some think happen everytime the mouse moves
(anywhere on the screen)?
 
For movements only within your own Windows Forms, the MouseMove event does
the job. If you need to be able to track the mouse outside screen real
estate that you control, set up a timer, and in the tick event get the
screen-relative mouse position via the Screen.MousePosition property, and do
whatever you need to do. To do something only when it moves, save the
current mouse position on each timer event, and compare the current mouse
position to the position you saved in the last event. If it's the same, do
nothing. If it's changed, do your thing.

HTH,
Tom Dacon
Dacon Software Consulting
 
Back
Top