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.
 
Back
Top