Moving a bitmap in a window

Hi All.

I am new to GDI programming. I need to write an app that upon receipt of a timer message I move a bitmap in the client window.

I know how to draw the bitmap, but what I need to do is restore the window where the bitmap was last before I redraw it. For instance, picture a bitmap of a fly that moves about a window where initially a large bitmap (a background - perhaps a picture of a picnic) has been drawn. I'd prefer not to redraw the background every time for performance reasons.

I think somehow if I can BitBlt into memory a small portion of the background image just before I draw the 'fly', then draw the fly, then on the next timer message restore the background with the saved portion.

Is this how this is done??

Thanks, G
I had wtitten a programme like this in the past. And I also used the BitBlt to save the portion of the background image into memory before I draw the moving object, then restore the background. I found it worked well.
Why don'y you write it , then run it to see the effect?
If you talking about a fly in front of a fixed bitmap, you don't have to cache the You can just re-blit the relevant part of the original bitmap.

What you're describing doesn't sound like it should be that processor intensive, assuming the bitmap has been pre-scaled to suitable dimension.

When it come to moving things about, people often use double-buffering to avoid flickering. And this approach relies on blit-ing being fast, so you can draw to an off-screen DC and then blit the whole lot onto the target DC quickly.

Andy
Topic archived. No new replies allowed.