Sunday, December 11, 2011

Is there a way to set the opacity of my picture box in vb.net?

I just learned that you cannot apply opacity to picture box and it is only available to the form, how sad.Is there a way to set the opacity of my picture box in vb.net?
This isn't so true. If your trying to achieve a picture box that allows you to see through partially you need to design your image beforehand as a bitmap, that has a transparent background, and then when you have drawn whatever your picture is going to be using some sort of image editing software, make that layer slightly transparent, say 60%. This will then write the bitmap with a transparent background, and will add transparency to the other layer too. On the vb side of things, you need to write 2 things in your code, firstly the image location which you probably already know how to, and secondly you need to set the parent to be the object behind the picture box, for example:



Mypicturebox.parent = me



This will then allow the control to display whatever is on its parent wherever it has transparency drawn. This should achieve what your trying to get at.



Hope this helps

No comments:

Post a Comment