I want the pbGrade
to be on top of pbItemtype
(pb = picture box)
pbItemtype.BackColor = Color.Transparent;
// Change parent for overlay PictureBox...
pbItemtype.Parent = pbGrade;
I already tried this but then the pbItemtype is not even appearing, also the 2 picture boxes change images (pbItemtype and pbGrade)
Well actually you can do that easily and in fact you already did.
The code works but you also need to correct the Location
as the nested PB will keep it previous one and thus will probably be off to the bottom right, probably leaving the visible size of the new Parent
.... :
pbItemtype.BackColor = Color.Transparent;
// Change parent for overlay PictureBox...
pbItemtype.Parent = pbGrade;
// Move it to the top left of the parent:
pbItemtype.Location = Point.Empty; // or some other position..
Transparency works well when nesting controls. It doesn't work when overlapping them, though !
(Of course the code we see will not exchange the images!)