I have a user control with two buttons on it. I want to make everything except the buttons transparent, so the main form on which it loads can be seen behind it. There is no code behind on the user control class, but in the designer I have set the backcolor property of all controls to Transparent. When I run the program, I can see different controls behind the button images.
Is there a way to add images here? The problem is, while all controls (user control and the 2 buttons on it) have their backcolor property set to Color.Transparent, when I run it, it's not transparent. The background shows an image of wherever my mouse moves on main form. I think the background of the user control does not refresh properly, but I am not sure how to handle this.
For example, if my mouse is on Button 1, then the background of Button 2 changes to the image on Button 1.
You need to create a simple text application to try and figure out where the problem is. Make a simple form with no more than three controls, in a similar configuration to what you have already. Then run some tests and see if you can identify the exact circumstances of the problem.
Transparent only tells the control to take on the background properties of the control that contains it.
Using the properties of the controls in Windows Forms, you CAN make the entire form really transparent, but you can only make the ENTIRE form, along with ALL of its contents, transparent. You cannot single out a control to be not transparent.
It can be done using calls to Win32 functions. Start reading these[^].