简体   繁体   中英

Semi transparent PictureBox c#

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

在此输入图像描述

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?

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

在此输入图像描述

pictureBox2 - my red background image

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

Before:

在此输入图像描述

After:

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM