0

我有两个 Picturebox 并且都应该是透明背景,但真正的问题是表单背景都是透明的,但彼此之间不透明。

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

4

4 回答 4

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

将两个盒子放在一起,然后打开您想要看到的盒子,关闭您不想看到的盒子,颠倒顺序在它们之间切换。

于 2012-06-19T17:35:40.920 回答
1
Me.Picturebox2.Parent = Me.Picturebox1 : Me.Picturebox2.Visible = True
于 2012-09-30T19:13:25.067 回答
1

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

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

所以它是透明的

于 2014-08-01T17:54:46.233 回答
0

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

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

 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
于 2013-01-24T19:28:01.210 回答