//when the gamePanel is painted private void gamePanel_Paint(object sender, PaintEventArgs e) { //loop through all the TransparentPictureBoxes in the ordered list (based on z-order) foreach (TransparentPictureBox pb in TransparentPictureBox.getAllPictureBoxes()) { //paint the ones that are on the panel if (pb.Parent != null && pb.Parent.Equals(gamePanel)) { pb.Paint(e); } } }