Reputation: 43
This is in regards to C# coding, im quite new to this programming language, and do not know much about any other as well, but what i would like to achieve is to have a picture box as the background, and have another picture box over lapping it but the transparent part has to show the picture box behind. I have been able to have a transparent picture box, but the thing is it only shows the form's back color rather than the picture box behind it. can anyone help with this?
IN other words a picture box over a picture box, but able to see through the first picture box where it is clear, and see the picture box behind.
Thanks in advance.
Upvotes: 4
Views: 4706
Reputation: 1396
Go to Project -> Add user control. Give that User Control the BackGroundImage. Drag your picturebox onto the the usercontrol. Make the PictureBox's Backcolor transparent. Build the project.
In the designer, you should be able to drag your new usercontrol onto the form. This will do what you want.
Upvotes: 1
Reputation: 33
for background, you can use Graphics. build a paint event for your form visually:
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
g.DrawImage(Image.FromFile("address of image"), 0, 0, this.Width, this.Height);
}
it will color the form and you don't need picturebox for background.
Upvotes: 0