本文介绍了如何在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
推荐答案
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);
}
}
这是结果!
[]
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[^]
try this
这篇关于如何在C#Windows应用程序中重叠两个带透明背景的图片框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!