Search code examples
c#user-controlstransparency

c# usercontrol transparency


it's possible to have a usercontrol over my form and set a transparency percentage? I Wish have the background of the usercontrol to 70% transparent, but the buttons and the rest of the components to 100%

it's possible? thanks


Solution

  • Try adding the following to the control's constructor:

    base.CreateParams.ExStyle |= 0x20;            
    SetStyle(ControlStyles.SupportsTransparentBackColor, true);
    
    BackColor = Color.FromArgb(0x80,0xFF,0xCC,0x33);