Real-time drawing.

perps

Member
Joined
Sep 8, 2005
Messages
14
Programming Experience
Beginner
Greetings to all.

I've been working on a simple paint application (ala MS Paint) that can draw lines, rectangle, ellipses etc but I have a problem in that none of it is drawn on the canvas in real-time (i.e. If the user was dragging out a rectangle, they would only see the shape drawn on the canvas when they released the mouse button, and not as they were dragging).
I want the user to be able see the lines/curves/shapes etc they are drawing in real-time, i don't want the application to just draw when the user releases the mouse button. What would be the best way to go about this, bearing in mind that i already have all the drawing code done. Most of it is called on a mouse up command, could i just call the drawing methods on a mouse down command instead (i.e. while the user is holding down the mouse button and dragging)??

Thanks,

- perps.
 
Thanks for the reply Kulrom.

I tried moving the code in question to be called to draw under mouse move instead of mouse up. Unfortunately, this just causes a 'fan' or 'wagon wheel' type effect, where lines are continually drawn around the first point while the left mouse button is held down and moved. All i basically want is to do is be able to draw straight lines, shapes etc the way they are done in MS Paint, whereby you see whatever it is you are trying to draw as you are dragging it.

Any ideas on what I can do to achieve this???

Thanks again,

- perps.
 
Back
Top