I'm drawing a graphic directly to a form, using a Paint event handler. All
works well, except that the graphic flickers when I resize the form. So, I
implement double-buffering for the form using the following function:
public void EnableDoubleBuf fering()
{
this.SetStyle(C ontrolStyles.Us erPaint, true);
this.SetStyle(C ontrolStyles.Al lPaintingInWmPa int, true);
this.SetStyle(C ontrolStyles.Do ubleBuffer, true);
this.UpdateStyl es();
}
I call the function from the form's constructor, and I get an
ArgumentExcepti on saying that an invalid parameter was used.. The call stack
indicates the exception is thrown in the System.Drawing library.
The code runs fine if I disable the EnableDoubleBuf fering() call, but of
course I still have flicker.
Am I missing something here? Any help figuring this out is much appreciated.
Dave Veeneman
Chicago
works well, except that the graphic flickers when I resize the form. So, I
implement double-buffering for the form using the following function:
public void EnableDoubleBuf fering()
{
this.SetStyle(C ontrolStyles.Us erPaint, true);
this.SetStyle(C ontrolStyles.Al lPaintingInWmPa int, true);
this.SetStyle(C ontrolStyles.Do ubleBuffer, true);
this.UpdateStyl es();
}
I call the function from the form's constructor, and I get an
ArgumentExcepti on saying that an invalid parameter was used.. The call stack
indicates the exception is thrown in the System.Drawing library.
The code runs fine if I disable the EnableDoubleBuf fering() call, but of
course I still have flicker.
Am I missing something here? Any help figuring this out is much appreciated.
Dave Veeneman
Chicago
Comment