加载窗体时添加这段代码:
//正确代码:
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.BackColor = Color.LimeGreen;
this.TransparencyKey = BackColor ;
//不要使用Color.Transparent;
this.BackColor = Color.Transparent;
this.TransparencyKey = BackColor;
而是要选择一个比较偏僻的颜色来做为TransparencyKey.