I was wondering how drawing applications draw the entire time the mouse is down without having empty gaps. What I mean is, for example if the program only drew circles at the mouse's X, y coordinate, then if the mouse went too quicly it would seem like a bunch of little circles开发者_开发百科 rather than a nice continuous line. How can this be done without constantly drawing a short straight line between where the mouse was 0.001 seconds ago and where the mouse now is. Thanks
It can't be done without constantly drawing a line between the current mouse point and the previous point, which is why this is what drawing programs generally do do.
Fancier drawing programs will fit curvy lines to multiple previous points to achieve a more natural drawing stroke, but the principle is the same.
Update: Based on a comment, it appears that you have a timer involved in your drawing code. This is surely unnecessary, since your application will generate a MouseMove event whenever the mouse is moved at all, and you can use that event to draw the next line.
You can draw a short curved line between where the mouse was 0.001 seconds ago and where the mouse now is.
The mouse positions are not continuous, if you move it faster than very slowly, you will get discrete unconnected points. You need to interpolate between these points using your preferred method.
精彩评论