How to process more than 1000 images in a C # application?

The winform control for displaying a list of images is currently implemented using the flowlayout panel and a set of graphic boxes. But even in thumbnail (64x64), when we start to approach 1000+ images, we get OutOfMemory exceptions - our real problem lies in the generation of thumbnails and creating the Image object.

I was not able to find any strategies from existing examples of viewing images on the network with a relatively large number of images, so does anyone have any links or strategies to solve this problem of displaying a list of 1000 images?

As a starting point, we really only need these image objects when a window with thumbnails is displayed. Then we will have only 10 image objects, but is there a more reasonable way to do this, besides loading and destroying image objects?

Thanks Edward

+4
source share
2 answers

You should only display one screen of images at a time.

When the user drags the scroll bar, destroy these images and load new ones.

+5
source

WPF does a great job of this. If you enable virtualization, the ListBox will only create the control visible on the screen.

In your case, keep a link to the images in the list. Place the pictureBox and based on the scroll bar change the image to pictureBox.

0
source

All Articles