Click here to Skip to main content
15,071,480 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I'm working on a UserControl which has two PictureBoxes.
One has the picture I want to display to the user and the other has a picture that I use as an overlay.

The overlay PictureBox uses a PNG image with a transparent background. However, every time I run the UserControl, the overlay does not display the transparent parts of the PNG image as transparent (It appears white).

I've tried modifying the BackGroundColor and all other tricks up my sleeve but nothing is working.

Can anyone help me?
Posted

This link[^] should be helpful. It basically says to derrive a new class from the control (PictureBox in this case) and override the OnPaintBackground method to do nothing.
   
Does changing the picturebox opacity property to something less 100% help?

My bad. I thought you could set the opacity for controls. You can only do that for Form objects. You will have to make a custom control to achieve your result.
   
v2
I do not know which language or IDE you are talking about but there is nothing like an Opacity property for PictureBoxes when programming in Visual Studio 2008 using VB.NET or C#.
   
you can try adding it to the parent first so,
picturebox2.parent = picturebox1.image
and then add opacity property
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900