How to draw animation in window app?

  • Thread starter Thread starter John
  • Start date Start date
J

John

How to draw anmation in window app? I mean... like how can
I draw a dot in window at a point then moves to another
point and we can see it moves. Please explain in detail.
 
John,

In order to do this, you will have to override the OnPaint method of
your control/form. In your onpaint event, you will have to take the
coordinates of the point, and then draw it at those coordinates.

Now, the part that creates the animation is different. Basically, you
will have some sort of timer that will control your frame rate. Each tick
of the timer is where you set up the information (not do the drawing) that
the drawing routine needs to render that frame of the animation. After you
set up the information (in this case, the coordinates of the point), you
call Invalidate, which will force a repaint. The repaint will then render
the frame according to the information you have set up, creating an
animation.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top