Picturebox with transparent image?

G

Guest

hi, I have got two pictureboxes. the second one has got a transparent image,
but the transparent area is not transparent and I can not see this area from
picturebox1. How can set the background to transparent? thanks.....juvi
 
T

tamberg

The code to draw a "transparent" bitmap in C# is something like:

Color c = ... // your "transparent" color
ImageAttributes a = new ImageAttributes();
ia.SetColorKey(c, c);
Graphics g = ... // e.g. the PaintEvent's Graphics
g.Clear(Parent.BackColor); // assuming this code is part of a control's

OnPaint method
g.DrawImage(..., a);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top