WinForm加载多个自定义控件时,会出现很严重的闪烁问题
解决办法:
在调用自定义控件的窗体内添加的:
protected override CreateParams CreateParams { get { CreateParams cp = base.CreateParams; cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED return cp; } }
在自定义控件中添加的:
protected override CreateParams CreateParams { get { var parms = base.CreateParams; parms.Style &= ~0x02000000; // Turn off WS_CLIPCHILDREN return parms; } }