views:

78

answers:

1

In an application in Silverlight I'm working on, I need to track the moves of the mouse. My problem is that using the MouseMove event, I don't have a continuous set of points if the user moves the mouse fast enough (if I add each point in a list I can have (10,10) en then (20,20)...)

I'd like to have ALL points where the mouse has been during the move. Do you have any idea ?

+1  A: 

This cannot work efficiently. The mousemove event of silverlight waits on the OS to send the signal with the coordinates to it. The operating system does not fire its event for every single point it moves, if it moves very fast. Most OS executes infinite loops, which checks for machine states, if these loops are fast, then it will probably pick up the mousemove for every point. If the mouse moves from (1,1) to (20,20) in 0.001ms, the OS will probably call the event at (10,10) or it will not at all if the loop does not hit it on time.

A way you can possibly speed this up is lessen the codes in your mousemove or make them async.

Another way is a mathematical way, to calculate the path based on what you have already collected.

Shawn Mclean
Ok I get your point it makes sense. I found a good article in order to find the all the points using Bresenham's line algorithm here: http://www.codeproject.com/KB/graphics/bresenham_revisited.aspx
Jalfp