Reputation:
I have Form1 which contains some pictureboxes with png images. When I hide Form1, and then show it again using Form1.Show(), i see a white box instead of the png image for less than 1 second...but I still can see it. It's strange that other larger images in the same Form1 are loading instantly...while this one needs some miliseconds to load. Can this be fixed by caching the images in memory or..?!
Upvotes: 1
Views: 1446
Reputation: 1049
Try and use SuspendLayout() & ResumeLayout(false) so the form won't change it's layout until the images are loaded. call
this.SuspendLayout();
before Show() and set boolians in the picturebox.LoadCompleted events to true, and call
this.ResumeLayout(false);
when all of them are true.
Upvotes: 1