I am writing a program that will play a slideshow (among other things). The slideshow is controlled by a backgroundWorker, and is set to a while(true) loop so it will constantly
What is the number of images and total size? I think it is better to load all images in array and assign them to horPicBox
than loading them multiple times. To use Dispose
first assign horPicBox.Image
to temp object, then assign horPicBox.Image
to null
or next image and call Dispose
at the end for the temp object:
Image img = horPicBox.Image;
horPicBox.Image = Image.FromFile(imagePaths[index]);
if ( img != null ) img.Dispose();