在窗体form代码中加入如下代码即可:
protected override CreateParams CreateParams { get { CreateParams cp = base.CreateParams; cp.ExStyle |= 0x02000000; return cp; } }
UserControl的Code
protected override CreateParams CreateParams { get { var parms = base.CreateParams; parms.Style &= ~0x02000000; // Turn off WS_CLIPCHILDREN return parms; } }