این کد رو کپی کن تو usercontrol درست میشه
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x00000020;//WS_EX_TRANSPARENT
return cp;
}
}
private int opacity;
public int Opacity
{
get { return opacity; }
set
{
opacity = value;
this.InvalidateEx();
}
}
protected override void OnPaintBackground(PaintEventArgs e)
{
Color bk = Color.FromArgb(Opacity, this.BackColor);
e.Graphics.FillRectangle(new SolidBrush(bk), e.ClipRectangle);
}
protected void InvalidateEx()
{
if (Parent == null)
return;
Rectangle rc = new Rectangle(this.Location, this.Size);
Parent.Invalidate(rc, true);
}
Source