Slow painting, flickering on complex forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Try this:

Create a form with about 50 labels on it. Make the BackColor of the form the
usual windows grey - and leave the labels as is.

Run the app.
Alt-Tab back and forth from another app (preferable one with a white
background - such as MS WORD).
On my (average spec) PC there is a noticeable flickering and you can
actually see each label paint its background first white, and then grey.
What am I doing wrong?1
 
Hello James,

It is tough to say with no code to see. Are you implementing double buffering?

Best of luck!

Your C# ally ,
RBischoff


JL> Try this:
JL>
JL> Create a form with about 50 labels on it. Make the BackColor of the
JL> form the usual windows grey - and leave the labels as is.
JL>
JL> Run the app.
JL> Alt-Tab back and forth from another app (preferable one with a white
JL> background - such as MS WORD).
JL> On my (average spec) PC there is a noticeable flickering and you can
JL> actually see each label paint its background first white, and then
JL> grey.
JL> What am I doing wrong?1
 
Hi James

Nope - don't see this behaviour - are you sure that you aren't thrashing the
machine somehow? I've got 200 labels on a form, and the repaint when the app
regains focus is pretty good. Certainly not individual repaints...

Nigel
 
Hi James

I've tried stressing my system more, and I guess I see what you mean - it's
still not that unnacceptable. But as another poster pointed out, you can
enable Double Buffering on your form using SetStyle in constructor like this:

Me.SetStyle(ControlStyles.DoubleBuffer Or ControlStyles.AllPaintingInWmPaint
Or ControlStyles.UserPaint, True)

That looked slightly better for me...let me know if that helps.

HTH

Nigel Armstrong
 
Back
Top