Home > Archive > C# > November 2004 > Buffer swapping
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| Does anyone know how to do flicker-free animation in GDI+? In GDI, you could
define memory device contexts, draw to them, and then blt the result to the
actual window context. So far, I've been unable to find a corresponding way
of doing things in GDI+
Any ideas?
| |
| Joel Martinez 2004-11-22, 3:58 am |
| You can do this in one of two ways.
1. Use automatic double buffering in windows forms. In the
constructor or form load event, simply execute this statement
this.SetStyle(
ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.DoubleBuffer,true);
2. If you want to do it manually, simply specify a globally scoped
Bitmap object, draw to that, then draw the finished image to the
screen in one shot. So something like:
private Bitmap imgBuffer;
....
Graphics g = Graphics.FromImage(this.imgBuffer);
Hope that helps,
Joel Martinez
Orlando .NET User Group
http://www.onetug.org
http://www.codecube.net
"toa" <toalmark@hotmail.com> wrote in message news:<iA3md.7925$rh1.201557@news2.e.nsc.no>...
> Does anyone know how to do flicker-free animation in GDI+? In GDI, you could
> define memory device contexts, draw to them, and then blt the result to the
> actual window context. So far, I've been unable to find a corresponding way
> of doing things in GDI+
>
> Any ideas?
|
|
|
|
|