This example describes a simple workaround for the C # WinForm control when a picture is opaque when it overlaps a transparent picture. Share to everyone for your reference, specific as follows:
In WinForm, if you put a transparent picture on a form, you can display transparency normally, but if you put the picture on another control, you will not be able to display the transparency effect.
To resolve this situation, you can use GDI + to paint a transparent picture on the control.
Here we will use a PictureBox2 control to overlap a PNG transparent picture for example:
All we need to do is add the Paint event to the PictureBox2 control and then draw the PNG transparent picture, as follows:
private void Picturebox2_paint (object sender, PaintEventArgs e)
{
Graphics g = e.graphics;
Image image = Image.FromFile (@ "E:\cclock.png");
G.drawimage (image, new point);
}
Read more about C # Interested readers can view the site topics: "C # Common control usage Tutorial", "WinForm Control Usage Summary", "C # Data structure and algorithm tutorial", "C # object-oriented Program design Introductory Course" and "C # programming Thread Usage Skill Summary"
I hope this article will help you with C # programming.