DoubleBuffering replaces old C style flipping??

aewarnick

Well-known member
Joined
Jan 29, 2003
Messages
1,031
Does

this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);

automatically draw the object to the background and then show it to the screen; therefore eliminating the need to draw a backbuffer like in C++?
 
You need to do all your painting in the OnPaint event though for it to be effective. Just call this.Invalidate() to cause OnPaint to fire.
 
Another good question. What is the point or advantage of setting the
AllPaintingInWmPaint flag when DoubleBuffer should be enouph. It just does not make sense to me yet.

And if you set AllPaintingInWmPaint you must also set UserPaint as well!

What is the advantage of declaring more than DoubleBuffer?
 
If you set AllPaintingInWmPaint you should set UserPaint to true too. AllPaintingInWmPaint prevents the background from being earased so it reduces flicker.
 
Just be careful about that one, though, as setting UserPaint to true on an already existing control will cause Windows to completely ignore it when it goes about painting your form; it will just be a small patch of garbled image and youll need to do *all* of the controls painting yourself.
 
Back
Top