C# – How to avoid blinking in Form.Invalidate()

cinvalidation

I'm using f.Invalidate() to repaint graphics in my C# program but the graphic blinks as it refreshes. I'm also using e.Graphics.DrawImage() inside the f_Paint() method.

Best Answer

You need to set DoubleBuffered to true.

Since it's a protected property, you'll need to make your own control:

class Canvas : Control {
    public Canvas() { DoubleBufferred = true; }
}