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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top