Resolved CustomControl Transparent BackGround

tim8w

Well-known member
Joined
Sep 8, 2020
Messages
95
Programming Experience
10+
I am writing a CustomControl. It is inherited from Control. I would like the user to be able to set the background of the control to ANY color including Transparent. When I try and set it "as a user", I get the error: "Control does not support transparent background colors.". Any ideas on how to make this work?
 
Solution
Simple enough. I guess I should have done more research. I simply added the following line to the Control Initialization:

Set Control to support Transparent Color:
        SetStyle(ControlStyles.SupportsTransparentBackColor, true);

tim8w

Well-known member
Joined
Sep 8, 2020
Messages
95
Programming Experience
10+
Simple enough. I guess I should have done more research. I simply added the following line to the Control Initialization:

Set Control to support Transparent Color:
        SetStyle(ControlStyles.SupportsTransparentBackColor, true);
 
Solution
Top Bottom