How to double buffer .NET controls on a form?

后端 未结 12 1756
旧巷少年郎
旧巷少年郎 2020-11-22 16:21

How can I set the protected DoubleBuffered property of the controls on a form that are suffering from flicker?

12条回答
  •  北海茫月
    2020-11-22 16:58

    nobugz gets the credit for the method in his link, I'm just reposting. Add this override to the Form:

    protected override CreateParams CreateParams
    {
        get
        {
            CreateParams cp = base.CreateParams;
            cp.ExStyle |= 0x02000000;
            return cp;
        }
    }
    

    This worked best for me, on Windows 7 I was getting large black blocks appearing when I resize a control heavy form. The control now bounce instead! But it's better.

提交回复
热议问题