Creating Thumbnails in a List View Control, Part 1
A long time ago, I needed to create an application in Windows that could enumerate the contents of a folder and present the images as thumbnails within a List View Control. I had found this article on CodeGuru.com that promised to show how to do all that, but actually created nothing more than confusion. There were a couple of classes listed on the website which showed how to use Threads to load images, but the classes were incomplete and there was no sample code provided. If you actually check out the article, you will see a long listing of comments dating back to 1999 of developers asking for sample code. It’s kinda sad to read because with this much demand, you think that someone would answer their requests. To add insult to the injury, I had actually tried to get in contact with the author, but the email bounced back to my inbox, stating that the email address does not exist with the ISP…
Well, with the options laid out in front of me, I did what any other ambitious developer would do: I tried to reverse engineer the application based off of the principles of the article. Now, while I was doing this, someone had actually emailed me code, stating that it was sample code from the website. My eyes widened when I first saw the email and thought to myself, “ALRIGHT!!! Now I can move on with my life!”. I raced to download the zip and unzip it to my desktop, which of course was my favorite repository for developer code… cough cough, and after waiting feverishly for 15 seconds for the files to unzip and for Visual Studio to open the first file, I realized … this wasn’t the code from the author on the website. What was going on here?
It was a completely different application, which also displays thumbnail images in a list view control, but nonetheless different. It was created by a different developer and had code contributed to it by several other developers, none of which I think are related. However, the code works and it does do what it advertised to do.
Now, since this code was freely given to me and no one has laid claim to it, it seems appropriate that this code base be used for educational purposes. So here it is! Download your copy of the code that was sent to me that promised to display thumbnail images in a list control.