Matthias Wandel
Matthias Wandel

Reputation: 6483

disable background painting

I'm using visual studio 2008

I have a control that dispays a processed image. Whenever the processing parameters are changed, I'd like to update this picture, but without flickering. If I could prevent windows from blanking the area before I paint, the flicker should, for the most part go away.

Question is, how to do this?

Something like: this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); Should do it, except that requires me to subclass the TableLayoutPanel control (something I spent an hour trying to do), and with what I achieved, that had no effect.

Is there an easy way to turn off background painting of my control?

Upvotes: 3

Views: 5184

Answers (2)

Moo-Juice
Moo-Juice

Reputation: 38825

Have you tried overriding the OnPaintBackground event and doing nothing?

protected override void OnPaintBackground(PaintEventArgs pevent)
{
}

Upvotes: 6

Mark Avenius
Mark Avenius

Reputation: 13947

try this:

this.SuspendLayout();
// do update here
this.ResumeLayout();

Clarification: this is the form

Upvotes: -1

Related Questions