使Picturebox透明于其他图片框?

时间:2012-06-10 09:40:36

标签: vb.net transparency transparent vb.net-2010

我有两个Picturebox,两者都应该是透明的背景,但真正的问题是对于表单背景是透明的而不是相互覆盖。

这是我的问题照片: http://www.saj-sa.com/problem.gif

4 个答案:

答案 0 :(得分:1)

Picturebox1.visible = true  \\ will turn on a box
Picture box.visible = false \\ will turn a box off

将两个盒子放在另一个盒子上然后打开你想要看到的盒子,然后关闭你不想看到的盒子,反转顺序以便在它们之间切换。

答案 1 :(得分:1)

Me.Picturebox2.Parent = Me.Picturebox1 : Me.Picturebox2.Visible = True

答案 2 :(得分:0)

我认为op希望两个图像都可见,但第一个女孩透明部分要真正透明,而不是隐藏另一个女孩。

要实现这一点,您需要将所有图像添加到SAME图形元素中,从最深的一个(背景)到最高的一个(顶部的一个)

 private back as New bitmap("C:/background.bmp") 
 private girlOnTop as New bitmap("C:/topGirl.bmp") 
 private girlInMiddle as New bitmap("C:/middleGirl.bmp") 

'set the size of your graphic base on the background 

 Dim BMP As New Bitmap(back.Width, back.Height) 

'create a graphic base on that
 Dim GR As Graphics = Graphics.FromImage(BMP)

'draw onto your bmp starting from the background
 GR.DrawImage(back, 0, 0)

'set X,y to the coordinate you want your girl to appear
 GR.DrawImage(middleGirl, X, Y)
 GR.DrawImage(topGirl, X, Y)

'clear the picturebox
pbox1.Image = Nothing

'now that we have draw all our image onto the same bitmap, assign it to your picturebox element
pbox1.Image = BMP

答案 3 :(得分:0)

添加面板1并将图像设置为面板1 添加面板2并将图像设置为面板2

将面板1或2拖动到面板1或2中,使其位于后面或前面

所以透明