Question How to make a pictureBox transparent to another pictureBox(Has image to explain well)


New member
Feb 7, 2017
Programming Experience
This is what all I have in my form.

So I have a panel that has a background color "Lime". Then I have 2 pictureBox. My pB1 has pure image without white spaces and my pB2 has a png image with a lot of white spaces. I want that when my pB2 hover over the pB1, the white spaces in pB2 will be filled by pB1 images. I do now know how I can do this. Any help will be appreciated. Thanks
When a control is transparent in Windows Forms, it means that it's parent can show through its background. As such, the only way for PictureBox1 to show through the background of PictureBox2 is for 1 to be 2's Parent, which you can set in code.
Yeah it seems work. But it limits the visibility of the pB2. I move pB2 through cursor. I can only see pB2 when its inside pB1 which is not what I want. I want the pB2 also to be seen in Form or wherever in the form. I just want when I hover in pB2, it'll remove white spaces in pB2 and fill it with pB1 as a background. Thanks for taking time to help me.
What you want is not going to happen with WinForms controls. You should instead probably switch to drawing both images using GDI+, either in a single PictureBox or directly on the form. There will not be an issue with transparency that way.
Top Bottom