4
votes

I want to make a PictureBox semi transparent: show the conent of a picturebox on the back put not the base color of the form.

My Project

enter image description here

The little PictureBoxs that are on the front shows the back color of the form (control) (it have "Transparent" as background color), but I want to show color Red (the background image of the big PictureBox). How can I do it?

1
Tough ask with WinForms, not kidding, I'm serious...Fᴀʀʜᴀɴ Aɴᴀᴍ
Look at this and this.Fᴀʀʜᴀɴ Aɴᴀᴍ
You see the Parent in the background. Usually the form, never another PictureBox unless you assign the Parent property in code. Check the PictureContainer class in this post.Hans Passant
No tranparency in winforms unless with nested controls. To nest inside a PB you need to code it, as Hans said..: picBoxSmall1.Parent = picBoxbig; picBoxSamll.Location = ....TaW
Is the red box a Picturebox?Kyle Williamson

1 Answers

1
votes

This may not exactly answer you question, if it is not helpful, I can delete my answer. I am not sure if I completely understood. If your background image is going to be a simple PictureBox with a single color, the following should code work.

pictureBox1 - an image of a simple star

enter image description here

pictureBox2 - my red background image

Bitmap b = new Bitmap("Star.png");
b.MakeTransparent(Color.White);
pictureBox1.Image = b;
pictureBox1.BackColor = pictureBox2.BackColor; 

Before:

enter image description here

After:

enter image description here