Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Displaying Thumbnails

Displaying Thumbnails

Scheduled Pinned Locked Moved C#
question
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mr_Mike
    wrote on last edited by
    #1

    I am creating an app that closly resembles MS Windows Explorer. Thetrouble is, I have no idea how the thumbnail objects were created that represent image files. Also, what oblect are the thumbnails and filenames placed in? Mr. Mike

    K H 2 Replies Last reply
    0
    • M Mr_Mike

      I am creating an app that closly resembles MS Windows Explorer. Thetrouble is, I have no idea how the thumbnail objects were created that represent image files. Also, what oblect are the thumbnails and filenames placed in? Mr. Mike

      K Offline
      K Offline
      krisp
      wrote on last edited by
      #2

      From what I have read somewhere... With your image item you call some method like, GetThumbnail or CreateThumbNail and Windwos actually stores these thumbnails and when another program calls GetThumbnail or whatever it is, it checks to see if a thumbnail is already present for that image. If so it returns that one, if not it creates a new one. I also read that there is no way of creating a new thumbnail once one is created, only way is to manually delete the thumbnail image from the disk. Because Windows may create a thumbnail for displaying in Explorer and then its too small for what you want so it stretches it in your app and it looks horrible. I have only read all this along time ago, never worked with any of it though. Thought this might be of some help to get you started. Look in the .Net class library for the System.Drawing.Imaging.Image class and see if a Get or Create Thumbnail method is some where there. Hope that helps.

      H 1 Reply Last reply
      0
      • K krisp

        From what I have read somewhere... With your image item you call some method like, GetThumbnail or CreateThumbNail and Windwos actually stores these thumbnails and when another program calls GetThumbnail or whatever it is, it checks to see if a thumbnail is already present for that image. If so it returns that one, if not it creates a new one. I also read that there is no way of creating a new thumbnail once one is created, only way is to manually delete the thumbnail image from the disk. Because Windows may create a thumbnail for displaying in Explorer and then its too small for what you want so it stretches it in your app and it looks horrible. I have only read all this along time ago, never worked with any of it though. Thought this might be of some help to get you started. Look in the .Net class library for the System.Drawing.Imaging.Image class and see if a Get or Create Thumbnail method is some where there. Hope that helps.

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        It's stored in a system image list, and there is a way to purge the list itself. Also, the method to which you're referring is System.Drawing.Image.GetThumbnailImage.

        -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

        1 Reply Last reply
        0
        • M Mr_Mike

          I am creating an app that closly resembles MS Windows Explorer. Thetrouble is, I have no idea how the thumbnail objects were created that represent image files. Also, what oblect are the thumbnails and filenames placed in? Mr. Mike

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          This really is an application-specific problem. Explorer's ListView (the common control 6 ListVew32) uses a system image list and many, many other things to query files type handlers for a certain interface (IThumbnailCapture) which returns an image that it stores in a cache (in this case, a hidden system file named thumbs.db). For your application, you could do something similar, although using the default controls leave much to be desired (not everything from Windows' common controls is wrapped in the .NET equivalents). Get thumbnails for your ListViewItems, add them to the ListView's LargeImageList property, and then set the appropriate ListViewItems' ImageIndex property to the index in which the thumbnail was inserted. In effect, these become the icons for the ListViewItems. Unfortunately, if you want the thumbnail view that Explorer boasts, it won't be an easy task. First, you must make sure your application is bound to common controls 6 (in .NET 1.1, call Application.EnableVisualStyles before calling Application.Run in your program's entry point, Main), or use a manifest file (see my article list for an article that describes it). Then you'll have to P/Invoke lots of Win32 native functions and override a lot of functonality. Not fun. :( I hope at least I gave you some idea of what Explorer does for the functionality you want. Again, though, it's really up to you about how to do it since you control the code in your app.

          -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups