Thumbnails

BigKev
StarLounger
Posts: 78
Joined: 10 Feb 2010, 12:54
Location: Jeddah, Saudi Arabia

Thumbnails

Post by BigKev »

In my search to be user friendly I wanted to show the Icon for a selected file in one of my applications. I wanted it to be the same as the icon shown in Explorer. After much trawling through the web I pieced together bits of code and came up with the class attached.

The Class code file contains a list of the References required.

Add a PictureBox control to your project, I called mine pb, Set the SizeMode property to StretchImage and then use this code to set the Image property.

Dim bm As Bitmap = Thumbnails.Thumbs.GenerateThumbnail(f, pb.Width, pb.Height)

pb.Image = bm
pb.Refresh()

Cheers,
Kevin
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78364
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Thumbnails

Post by HansV »

Hi Kevin,

Thanks, but your attachment contains a .7z file. Not all Loungers will be able to open this file, since the zip functionality built into Windows doesn't support the 7-Zip format.
Best wishes,
Hans

BigKev
StarLounger
Posts: 78
Joined: 10 Feb 2010, 12:54
Location: Jeddah, Saudi Arabia

Re: Thumbnails

Post by BigKev »

Sorry, I selected the .Zip option from 7-Zip and it added a .7z file to a .Zip archive. Reposted with a .Zip file attachment.
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78364
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Thumbnails

Post by HansV »

Thanks, that's better.
Best wishes,
Hans