Laden...

zweite transparente PictureBox auf Erste legen

Erstellt von digi333 vor 13 Jahren Letzter Beitrag vor 13 Jahren 1.203 Views
D
digi333 Themenstarter:in
290 Beiträge seit 2006
vor 13 Jahren
zweite transparente PictureBox auf Erste legen

Ich mochte eine zweite PictureBox transparent auf die Erste legen.Wenn ich als BackgroundColor transparent eingebe und das Bild transparent mache, ist es zwar heller aber nicht das untere Bild scheint nicht durch.


       Bitmap original1 = new Bitmap(@"...png");
            pictureBox1.Image = original1;
            Bitmap original2 = new Bitmap(@"...png");
                
            Bitmap temp = new Bitmap(original2.Width-10, original2.Height);
            Graphics g = Graphics.FromImage(temp);
            ColorMatrix cm = new ColorMatrix();
            cm.Matrix33 = 0.5f;

            ImageAttributes ia = new ImageAttributes();
            ia.SetColorMatrix(cm, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
            g.DrawImage(original, new Rectangle(0, 0, temp.Width, temp.Height), 0, 0, original.Width, original.Height, GraphicsUnit.Pixel, ia);
            g.Dispose();
                
            
            pictureBox2.Image = temp;

49.485 Beiträge seit 2005
vor 13 Jahren

Hallo digi333,

du musst die PictureBoxen ineinander, nicht aufeinander legen. Siehe [Artikel] Zeichnen in Windows-Programmen. Da wird genau das gemacht.

herbivore