I am making an application in C#.NET with Visual Studio 2012.
I have a picture in my background form. I have several picture boxes on it. I used .png images with transparent background but in my form it is not transparent when it comes above another image.
Set your picture box back color property to transparent.
pictureBoxTest.BackColor = Color.Transparent;
To further explain, an image with a transparent background will inherit the picture box's background color. You need to set the color to transparent as well to ensure it truly is.
Related
I need to put a picturebox above another picture box, the picturebox on top is a png file with a transparent background but when trying to use Picturebox.BringToFront(); the picturebox below is replaced with what is in the background of the form.
I tried to get around this using picturebox.Parent = picturebox2, but I don't want the picturebox to be cut off at the edges of the other picturebox it's on top of.
When making a menu screen I noticed that the panel wasn't perfectly white.
Menu Screen:
These are my settings:
I've tried making a .png image and adding it to the panel but that just makes the panel go black.
Any help would be much appreciated.
Remove Any Source Image You Have In Your Panel, In Your Case I Saw That There Is A SourceImage Called Background, To Fix The Color Issue Remove It, The Source Image Also Has A Light Kind Of Gray Background Which Overrides The Color Of Image Component. Keep The Source Image To None.
I'm doing the table game battleship, by moving pictures boxes with the mouse, the problem is that all the picture boxes that I have contain an image without background, but i have the problem that when I move it through different points, it shows a default background instead of showing the background of the "map". This messes the aspect of the game table.
I've tried this code in my program ,but it makes the ships default position is in the panel(which I do not want) and it doesn't solve the problem I described earlier (when you move ships over the others spaces)
Barco1.Parent = panel1;
Barco1.BackColor = Color.Transparent;
An example of one of the ships
As you can see in the picture, there are:
Form with a BackgroundImage,
Panel with BackColor = Color.Transparent and BackgroundImage = some-image and
PictureBox with BackColor = Color.Transparent and an image as its Image property.
It should work for you.
It looks like You are setting the Image background as Transparent but You are adding that Image into another Panel!
Barco1.Parent = panel1;
So, Set the Background Color of the Panel1 as Transparent:
panel1.BackgroundColor=Color.Transparent;
Good afternoon!
I have several user controls, each one with a picture box containing an image. A user control represents the backgroud and the other two are elements that must be overlayed.
pictureBox_background.BackColor = Color.Black;
pictureBox_A.BackColor = Color.Transparent;
pictureBox_background.Controls.Add(pictureBox_A);
pictureBox_background.Controls.Add(pictureBox_B);
pictureBox_B.SendToBack();
pictureBox_A.BringToFront();
With this code I get the picturebox A is over picturebox B, but I can not make the background of the element A is the image of the picturebox B. The pictureBox A reaches the background picturebox, and it's background is the black color of the background picturebox.
That is, the transparency of picturebox_A don't shows the picturebox_B, shows the black background, without showing the image of the medium (picturebox_B).
It's a little hard to explain. I hope it was understood.
Thanks in advance!
I have a problem with:
BackColor = Color.Transparent;
It's not working correctly. I have a form with a blue background, and a picturebox with a picture loaded in it. It's not actually taking what's in the picture, but rather - the form's background color. Please tell me there's a simple way to go around this?
What you see in the following screenshot is a custom usercontrol with it's backColor set to transparent, on top of a picture, in a form with a blue background.
I need the usercontrol to display what's UNDER it, as real transparency, it should be showing the gradient and part of the image.
Try setting the picture box to be the parent of the custom user control.
myControl.Parent = this.myPictureBox;
Try calling "SetStyle(ControlStyles.SupportsTransparentBackColor, true);" on your user control constructor.
more details at: http://msdn.microsoft.com/en-us/library/wk5b13s4(v=vs.90).aspx