Bee Eee Blog

Tag: c# gui

c# .Net double buffering — plus a little

by brian on Jan.08, 2008, under .NET, GUI, Uncategorized, c#, c# coding GUI, coding

It seems I left out something that helps the quality of the .Net provided form double buffering when you are doing custom drawing. Just override OnPaintBackground and leaving it blank. This prevents the background from being momentarily drawn when you don’t want it to be.

so again here’s how to enable double buffering on the form:

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

And then the override

protected override void OnPaintBackground(PaintEventArgs e)
{
}
Leave a Comment : more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...