如何在C#Windows应用程序中重叠两个带透明背景的图片框 [英] How to Overlap two picture box with transparent background in C# Windows Application

查看:115
本文介绍了如何在C#Windows应用程序中重叠两个带透明背景的图片框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我正在制作打印软件,我需要将两个带有透明背景的图片框重叠,以便互锁图像。请有人告诉我如何实现它。



谢谢

Hi All

I am working on printing software in which i need to overlap two picturebox with Transparent Background for interlocking images.Please anyone tell me how to achieve it.

Thanks

推荐答案

尝试将所有儿童图片绘制为父图片!!



Try draw all child picture to parent picture!!

void ParentPictureBox_Paint(object sender, PaintEventArgs e)
{
    Graphics g = e.Graphics;

    var controls = this.ParentPictureBox.Controls.OfType<PictureBox>();
    foreach (var c in controls)
    {
        g.DrawImage(c.Image, c.Location.X, c.Location.Y, c.Width, c.Height);
    }
}





这是结果!

tmp - imgbb.com [ ^ ]


hai

只是将背景设置为transparaent

pictureBox.BackColor = Color.Transparent;



http:/ /stackoverflow.com/questions/5522337/c-sharp-picturebox-transparent-background-doesnt-seem-to-work [ ^ ]





hai
just set background as transparaent
pictureBox.BackColor = Color.Transparent;

http://stackoverflow.com/questions/5522337/c-sharp-picturebox-transparent-background-doesnt-seem-to-work[^]


pictureBox7.Controls.Add(pictureBox8);
   pictureBox8.Location = new Point(0, 0);
   pictureBox8.BackColor = Color.Transparent;







http://stackoverflow.com/questions/19910172/how-to-make-picturebox-transparent-in -c-net [ ^ ]

试试这个




http://stackoverflow.com/questions/19910172/how-to-make-picturebox-transparent-in-c-net[^]
try this


这篇关于如何在C#Windows应用程序中重叠两个带透明背景的图片框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆