moving forms background image

rowlandsfc

Active member
Joined
Feb 3, 2019
Messages
43
Location
bridgend
Programming Experience
Beginner
im creating a game where i need the background image to move to the left evry time i click on the key d, i got it working with a picture box but when i add another picture box and set it to transparent it shows the forms background rather than the first picturebox image, if it is possibly to move the forms background image please let me know or to ensure that the 2nd picturebox shows what is in the 1st picture box when set to transparent would be fine too

thanks
 
Neither are possible. There are a few different layout options for the BackgroundImage but you cannot specify a location. As for transparent controls, Windows Forms doesn't support genuine transparency and just fakes it by having a child control effectively display its parent as its own background. The only way a PictureBox can show through another PictureBox is if one is the parent of the other. That is possible, although you have to do it in code, as you cannot add children to a PictureBox in the designer. It also means that the child cannot be displayed beyond the bounds of the parent. If that's a problem, you may be able to get around that by having another PictureBox that is not a child that occupies the same area on the screen as the child, so you can see a transparent one inside the other PictureBox and still see on in the right place outside too.
 
Back
Top Bottom