Making UserControls Transparent

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

UserControls do not let the BackColor Property to be set to Transparent.
When placed on a color background, they look ugly. Panels and GroupBoxes can
be made transparent. How does one go about doing the same with UserControls.

Thanks
 
Hi Jav,

In the usercontrol's constructor set the style for supporting transparent
bkg colors

this.SetStyle(ControlStyles.SupportsTransparentBackColor |
ControlStyles.UserPaint, true);

Now you can set the background color you want.
 
Thank you. That did the trick.
Jav

Stoitcho Goutsev (100) said:
Hi Jav,

In the usercontrol's constructor set the style for supporting transparent
bkg colors

this.SetStyle(ControlStyles.SupportsTransparentBackColor |
ControlStyles.UserPaint, true);

Now you can set the background color you want.

--
HTH
Stoitcho Goutsev (100) [C# MVP]


Jav said:
UserControls do not let the BackColor Property to be set to Transparent.
When placed on a color background, they look ugly. Panels and GroupBoxes
can
be made transparent. How does one go about doing the same with
UserControls.

Thanks
 
Back
Top