Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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++?

C#
  • *Experts*
Posted
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.
Posted

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?

C#
  • *Experts*
Posted
If you set AllPaintingInWmPaint you should set UserPaint to true too. AllPaintingInWmPaint prevents the background from being earased so it reduces flicker.
  • *Experts*
Posted
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 you'll need to do *all* of the control's painting yourself.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...