自定义透明层控件
public TransparentLayer()
{
InitializeComponent();
SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque , true);
this.BackColor = Color.Transparent;
}
protected override void OnLocationChanged(EventArgs e)
{
Visible = false;
Visible = true;
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x00000020;
return cp;
}
}