Move an image without flickering ?

P

Polaris

Hi Experts:

My program (Windows Form with C# and .net 2.0) shows a bitmap (a bitmap file
selected by the user) and allows the user to drag it to different positions
within the client area. I use Graphics.Clear() and Graphics.DrawImage(...)
to repeatly clear the client area and re-draw the bitmap. The result is not
good because the visual flickering.

Is there a better way to move an bitmap smoothly?

Thanks In Advance!
Polaris
 
M

Michael C

Polaris said:
Hi Experts:

My program (Windows Form with C# and .net 2.0) shows a bitmap (a bitmap
file selected by the user) and allows the user to drag it to different
positions within the client area. I use Graphics.Clear() and
Graphics.DrawImage(...) to repeatly clear the client area and re-draw the
bitmap. The result is not good because the visual flickering.

Is there a better way to move an bitmap smoothly?

Do the Graphics.DrawImage first as you are doing, then do a graphics.SetClip
to exclude the area you have just drawn and then do Graphics.Clear.

Some people here will probably suggest you turn on double buffering but this
is memory intensive and certainly overkill for what you are doing.

Michael
 

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

Similar Threads


Top