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)
{
}
