Reputation: 642
Why does not a user control have the 'Opacity' property? How can I use set the property on a user control?
Upvotes: 0
Views: 805
Reputation: 3032
For WinForms
You can just set User Control Background property to Transparent
in web colors tab
but for opacity such as 50% i am looking for a solution.
Upvotes: 0
Reputation: 8636
For winforms
To make a UserControl transparent, we have to give it a WS_EX_TRANSPARENT
style, override its OnPaintBackground
method to draw the background with the opacity
, and then invalidates its Parent to redraw the control whenever we need to update the graphics
Upvotes: 1