[Message Deleted]
-
public static System.Drawing.Drawing2D.GraphicsPath Transparent(Image im)
{
int x;
int y;
Bitmap bmp = new Bitmap(im);
System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
Color mask = bmp.GetPixel(0, 0);for (x = 0; x <= bmp.Width - 1; x++) { for (y = 0; y <= bmp.Height - 1; y++) { if (!bmp.GetPixel(x, y).Equals(mask)) { gp.AddRectangle(new Rectangle(x, y, 1, 1)); } } } bmp.Dispose(); return gp; }
Then in your form load event handler
System.Drawing.Drawing2D.GraphicsPath gp = Resources.Images.Transparent(pictureBox1.Image);
pictureBox1.Region = new System.Drawing.Region(gp);I know nothing , I know nothing ...
-
First, don't use PictureBoxs. Next, Color.Transparent is not really Transparent as you're expecting it to be. Transparent only tells the control to take on the background properties of the control that contains it. In other words, there is no true Transparency. Having said that, in your example, the control in the middle will NOT be visible in the transparent areas of the top control. It'll disappear behind the borders that makes up the top control window. A better option would be to drop a Panel control on the form, resized or docked as needed, then just draw each image yourself in the Paint event of Panel control. You'll have much greater control over the transparency.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008