How to show thumbnails

  • Thread starter Thread starter Keith Smith
  • Start date Start date
K

Keith Smith

How can I have a box (maybe a picture box or a panel or something?) that
will display all of the contents of a particular folder and show the picture
files as thumbnails along with the name of the file right below them?

I then need to be able to drag each item onto another picture box (or
something similar) where the picture will be displayed.

How can I accomplish this?

I have c#
 
You can display the pictures in a PictureBox just fine. From your post, I'm
wondering how much you know about C#? It sounds like you don't have much
experience at all with it. In fact, your question sounds a lot like, "Can
someone write this program for me?" In which case, you probably won't get an
answer to that question.

People here will be happy to help with specific problems, but I doubt anyone
is going to take the time to write the program for you.

But, if that's not your question and I'm assuming too much, here's a rough
idea of the direction to go:

You'll need to load the images from the folder one at a time. See the Image
class. To create thumbnails, you'll need to scale them down to whatever size
you want the thumbnails to be. This involves calculating a simple aspect
ratio and then scaling by a factor to maintain the aspect ratio (unless you
don't mind the images being squished in one direction or another).

You'll want to dynamically create PictureBox controls and place them on your
form, setting the location of each one and setting the Image property.

There's a sample app here that does a lot of this:
http://www.codeproject.com/useritems/Google_Image_Search_API.asp

Instead of loading the files from a folder, it gets them from Google Image,
but the rest is pretty similar to what you're trying to do.

Pete
 
The best way would be to enumerate all the files and add them to a ListView
control and then use the shell interface IExtractImage to extract the
thumbnail for each file. This involves some pretty heavy P/Invoke stuff
though.

----------------
-Atul, Sky Software http://www.ssware.com
Shell MegaPack For .Net & ActiveX
Windows Explorer GUI Controls
&
Quick-Launch Like Appbars, MSN/Office2003 Style Popups,
System Tray Icons and Shortcuts/Internet Shortcuts
 
Back
Top