y_zyx
y_zyx

Reputation: 642

opacity usercontrol c#.net 3.5

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

Answers (2)

Saleh
Saleh

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

Developer
Developer

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

Related Questions