Is it possible for us to turn WS_EX_COMPOSITED on ONLY when a Panel/Container Control is being scrolled, then turning it off? Having it activated for the whole lifespan of the application, affects every controls surrounding my application, I only need it activated when the Panel it's being scrolled.
Something like that:
private int originalExStyle = -1;
private bool _scrolling = false;
protected override CreateParams CreateParams
{
get
{
if (originalExStyle == -1)
originalExStyle = base.CreateParams.ExStyle;
CreateParams cp = base.CreateParams;
if (_scrolling)
cp.ExStyle |= 0x02000000; // Turn on
else
cp.ExStyle = originalExStyle; // Reset to original state
return cp;
}
}
protected override void OnScrollBegin(ScrollEventArgs se)
{
base.OnScrollBegin(se);
_scrolling = true;
RecreateHandle();
}
protected override void OnScrollEnd(ScrollEventArgs se)
{
base.OnScrollEnd(se);
_scrolling = false;
RecreateHandle();
}