I just went through a lot of work trying to figure out why some of my PictureBoxes had their draw methods called while others didn't. I'm looking at the MSDN for PaintEventArgs and it doesn't seem to explain things very well.
So here's what happened. I had a TableLayoutPanel filled with Pictureboxes which were filled with images. I added the TableLayoutPanel to my form and that whole thing drew just fine. I had an additional 8 pictures to draw as well, but those weren't as lucky. Since they didn't need a TLP I just used PictureBoxes and added all 8 pictureboxes to my form, and only one of them was being drawn at a time. For some reason, only the first draw method that I had was being called. So the TLP and one of the 8 additional images were had their draw methods being called.
I fixed this by calling the draw methods of the other 7 images from the first image, but this seems hacky to me. This solution works in this specific instance, but I would like to know what went wrong with this setup. As far as I can see this is some logic which I'm not understanding rather than a flaw with my coding.
So here's what happened. I had a TableLayoutPanel filled with Pictureboxes which were filled with images. I added the TableLayoutPanel to my form and that whole thing drew just fine. I had an additional 8 pictures to draw as well, but those weren't as lucky. Since they didn't need a TLP I just used PictureBoxes and added all 8 pictureboxes to my form, and only one of them was being drawn at a time. For some reason, only the first draw method that I had was being called. So the TLP and one of the 8 additional images were had their draw methods being called.
I fixed this by calling the draw methods of the other 7 images from the first image, but this seems hacky to me. This solution works in this specific instance, but I would like to know what went wrong with this setup. As far as I can see this is some logic which I'm not understanding rather than a flaw with my coding.