3

I've got an issue where some computers (rarely) start to flicker when using our application. I found some odd code in the main form of our app:

    protected override CreateParams CreateParams
    {
        get
        {                
            var cp = base.CreateParams;
            cp.ExStyle |= 0x02000000;//composite window. Composite windows do not render/flickr when controls are born.  This speeds up loading.
            return cp;
        }
    }

The code appears to be sourced from an online source where they warn:

You should be aware of the fact, though, that this only works in environments where all control painting(within the hierarchy) is done within WM_PAINT. Applications using other/asynchronous means of rendering into a control within the hierarchy will likely have theirs problems with this solution causing unwanted behavior.

What exactly is WM_PAINT? Do they mean all controls need to be painted via win32 API calls or is this what happens normally in a Load event?

There's a note saying the code was added to reduce a bug report regarding flicker...I just wonder if they threw the baby out with the bathwater on this one.

P.Brian.Mackey
  • 41,438
  • 63
  • 228
  • 337

1 Answers1

1

Try using DoubleBuffered = true;

vbtheory
  • 343
  • 3
  • 17