How to prevent UI Flickering

  1. Create winform below code
protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;  // WS_EX_COMPOSITED
                cp.ExStyle |= 0x02000000;
                return cp;
            }
        }

WS_EX_COMPOSITED works by forcing child windows to draw back to front and by double buffering them;  (더블버터링을 위해서는 위 옵션을 사용한다.)

2. Set Double Buffering

this.SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.DoubleBuffer,
true);