-
Dec 30th, 2011, 12:46 AM
#1
Thread Starter
Member
[RESOLVED] VB.NET Form and Picturebox Transparency HELP!
Hello everyone! Thank you for your time and interest in reading my post.
I have a problem. I want to try an simulate a fake lighting system in Visual Basic 2010 by using 2 images. One is Form1's background, and the other is Picturebox2's image. Picturebox2's image is a black background with a transparent circle in the middle. The only problem is, when transparent, it shows the background of the form, and looks right through the background image. How could I get around this so that the transparent part of the image is Form1's background image, and not the backcolor?
Sorry if that's confusing; I can elaborate more if needed.
Thanks!
-
Dec 30th, 2011, 01:18 AM
#2
Re: VB.NET Form and Picturebox Transparency HELP!
I dont quite understand, could you make it a little clearer what it is you're trying to do and what is actually happening ?
-
Dec 30th, 2011, 01:23 AM
#3
Thread Starter
Member
Re: VB.NET Form and Picturebox Transparency HELP!
Originally Posted by Niya
I dont quite understand, could you make it a little clearer what it is you're trying to do and what is actually happening ?
I figured someone would say that. I'm terrible at explaining things! :P
I have Form1 with a background image of 'bg.png'
I have Picturebox1 with a an image of a square, but part of it's transparent. It doesn't show the Form1's background image, just the backcolor of the form, as if there were no image.
* SIMPLER TERMS*
Picturebox = Transparent
I want picturebox to show form1's background image
but it doesn't.
THANKS FOR YOUR TIME, HOPE YOU CAN HELP!
-
Dec 30th, 2011, 04:34 AM
#4
Re: VB.NET Form and Picturebox Transparency HELP!
Hi coldfire, I thought your initial explanation was perfectly clear. But the cause of the problem isn't. Did you set the BackColor of the picture box to Transparent? Otherwise you will just see through the transparent areas of the image to the picture box's background color (not the background of the form).
BB
-
Dec 30th, 2011, 04:58 AM
#5
Thread Starter
Member
Re: VB.NET Form and Picturebox Transparency HELP!
Originally Posted by boops boops
Hi coldfire, I thought your initial explanation was perfectly clear. But the cause of the problem isn't. Did you set the BackColor of the picture box to Transparent? Otherwise you will just see through the transparent areas of the image to the picture box's background color (not the background of the form).
BB
Wow. I feel like a total idiot; it was that obvious. Thank you so much!
[RESOLVED]
-
Apr 23rd, 2013, 11:46 AM
#6
Fanatic Member
Re: [RESOLVED] VB.NET Form and Picturebox Transparency HELP!
I have an additional question about this. The transparency only shows the form's background. I have another picturebox1 under picturebox2 but it still shows form's background. Let me give you a snapshot:
Is there any trick to solve this problem?
-
Apr 23rd, 2013, 12:13 PM
#7
Re: [RESOLVED] VB.NET Form and Picturebox Transparency HELP!
The transparent parts of a WinForms control show the control's Parent, but not sibling controls. You can't change that, it's the way Forms rendering is designed. That means you could set one PictureBox to be the Parent of another, but then you won't see the form.
The best way round this is to paint all the cards etc. in the Paint event of the Form using Graphics.DrawImage statements, instead of using PictureBoxes. It may look a little difficult at first, but once you get used to it you can play with transparency as much as you like.
BB
-
Apr 23rd, 2013, 03:05 PM
#8
Fanatic Member
Re: [RESOLVED] VB.NET Form and Picturebox Transparency HELP!
Got it boops boops. Thanks for detailed information
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|