【发布时间】:2012-06-10 09:40:35
【问题描述】:
我有两个图片框,都应该是透明背景,但真正的问题是表单背景都是透明的,但不能相互覆盖。
这是我的问题的照片: http://www.saj-sa.com/problem.gif
【问题讨论】:
标签: vb.net transparency transparent vb.net-2010
我有两个图片框,都应该是透明背景,但真正的问题是表单背景都是透明的,但不能相互覆盖。
这是我的问题的照片: http://www.saj-sa.com/problem.gif
【问题讨论】:
标签: vb.net transparency transparent vb.net-2010
Picturebox1.visible = true \\ will turn on a box
Picture box.visible = false \\ will turn a box off
将两个盒子放在一起,然后打开你想看到的那个,关闭你不想看到的那个,颠倒顺序在它们之间切换。
【讨论】:
Me.Picturebox2.Parent = Me.Picturebox1 : Me.Picturebox2.Visible = True
【讨论】:
添加面板 1 并将图像设置为面板 1 添加面板 2 并将图像设置为面板 2
将面板 1 或 2 拖到面板 1 或 2 中,使其位于后面或前面
透明的
【讨论】:
我认为 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
【讨论】: