Tearing in my animation on WinForms C#

后端 未结 1 780
抹茶落季
抹茶落季 2021-01-21 16:46

I am using a library in which enables me to animate movement of WinForm elements (linked below), when I use it to move a transparent panel across the form (which has a picture b

相关标签:
1条回答
  • 2021-01-21 16:59

    I used this ages ago when I had trouble with controls on a form flickering, in my case there were many controls and when loading the form the controls would flicker quite badly.

    In the end I used this:

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

    Paste that in your form.

    It activates double buffering at the form level and for all controls within it. HOWEVER, while it stopped my flickering issue it greatly reduced the speed at which the forms elements seemed to move as they don't get drawn until they are 100% ready.

    I guess you can try and see if it suits your situation.

    0 讨论(0)
提交回复
热议问题