I am trying to create an ImageListBox control that displays a large number of thumbnails, such as the one that uses Picasa.
This is my design:
I have a FlowLayoutPanel that is populated with a lot of UserControl objects, for example 4000. Each UserControl assigned a delegate for the Paint event. When the Paint event is triggered, it checks the memory cache for the thumbnail and, if the image is not in the cache, it retrieves it from disk.
I have two problems that I am trying to solve:
WinForms seems to fire a Paint event, even if the UserControl not displayed. In fact, only 10 or so controls are in sight, the rest are not ( FlowLayoutPanel.AutoScroll set to true ). As a result, he tries to extract thumbnails for all the images and takes a lot of time.
Adding UserControl objects to the FlowLayoutPanel takes a little longer, about 2-3 seconds. I can live with him, but I wonder if there is a better way to do this than:
UserControl[] boxes = new UserControl[N];
everwicked
source share