Make Picturebox transparent over other picturebox?

不想你离开。 提交于 2019-12-06 15:26:20

问题


I have two Picturebox and both should be transparent background, but the real problem is both transparent for form background but not over each other .

here's photo of my problem: http://www.saj-sa.com/problem.gif


回答1:


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

Place both boxes over one another then turn on the one you want to be seen, and off the one you do not want to see, reverse the order to switch between them.




回答2:


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



回答3:


I think op want to have both image visible, but the 1st girl transparent part to be really transparent, and not hide the other girl.

to achieve that you need add all of your image into the SAME graphic element, starting from the deepest one ( background) to the highest one ( the one on the top )

 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



回答4:


add panel 1 and set image to panel 1 add panel 2 and set image to panel 2

drag panel 1 or 2 into panel 1 or 2 you want to make it behind or front

so it transparent



来源:https://stackoverflow.com/questions/10967690/make-picturebox-transparent-over-other-picturebox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!