In TabControl to get rid of the flicker of child windows

When resizing a form, I set the style WS_EX_COMPOSITED

But at the same time, the Splitter stops drawing at dragging.

How can this be solved?

Thank.

/// <summary> /// H_TODO: Избавляюсь от flickering в дочерних окнах. Но при этом возникает проблема с отрисовкой Splitter при перемещении /// </summary> protected override CreateParams CreateParams { get { CreateParams cp = base.CreateParams; cp.ExStyle |= User32.WS_EX_COMPOSITED; return cp; } } 
  • Where is the Splitter? - 4per
  • On several levels below TabControl. - Track

1 answer 1

It seems that you can not do without a hack.

Given that the flag is needed only for resizing, then simply at the beginning of the resize of the form, set the WS_EX_COMPOSITED flag and after resize, we remove it.

  private const int GWL_EXSTYLE = -16; private const int WS_EX_COMPOSITED = 0x02000000; [DllImport("user32.dll")] private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);