Simple minded one

  • Thread starter Thread starter web02
  • Start date Start date
W

web02

Hi y'all,

I haven't had to program using many graphics, so . . .

I want to do something for fun and I have to animate some simple shapes. I
need some insight to perform this simple task to get me going.

Just draw a rectangle centered on the left side of the screen and
sequentially move it across the screen to the right side.

That be it. What programatic actions must I perform to keep erasing (hiding
against a patterned background) and redrawing the rectangle to simulate the
motion.

Thanx,
Bill
 
Hi Bill,

You can override the OnPaint event of your control and paint the rectangle
manually. You can then use whatever means to "move" the rectangle (be it a
timer, the mouse, etc.) and invalidate the control, forcing a paint event.
Note that you can optimize the invalidation by passing an invalid rectangle
equal to the rectangle that is the interesection of the old rectangle's
position and the new rectangle's position, speeding up the drawing a little
bit. You can also paint the background as needed in this event as well.

Hope that helps!
 
Back
Top