简体   繁体   中英

how to show the files thumbnails like windows explorer in delphi?

I use the TFileListBox control to show lists of files. But I wonder how to show the file thumbnails in the same way that Windows Explorer does?

You should try using the ShellControls components included in Delphi. (Note that David Heffernan sort of mentioned, and TLama made the initial specific suggestion in the first two comments to your question.) They're not installed by default in recent versions, so you'll have to install them yourself.

These instructions are for the version of Delphi you've indicated you're using (Delphi 2010) - they're the same basically for XE/XE2 , except they're in the Samples\\Delphi\\VCL\\ShellControls folder instead (and the Start entry contains XE or XE2 instead of 2010 , of course).

Use Start->All Programs , navigate to the Embarcadero RAD Studio or Embarcadero Delphi 2010 item, expand it, and choose Demos . It's in the Win32 folder under DelphiWin32\\VCLWin32\\ShellControls . Open and build the vclshlctrls.dproj first, and then build and install the dclshlctrls.dproj . You'll need to add the folder above to your Project->Options in the search path for the compiler to be able to find them.

To install the components after building the second package, right-click on the project in the 'Project Manager' and choose 'Install' from the popup (context) menu. The 'Project Manager' in the default configuration is the area on the right edge of the screen that displays the files in the project. Remember, you need to build vclshlctrls first, and then install dclshlctrls , which is the design-time package.

You should then find the TShellListView , TShellTreeView , TShellComboBox , and TShellChangeNotifier components on your palette in the Samples category.

.thumb files are ordinary png files, just with a different file suffix. Knowing this one can display them in a TImage.

First the .thumb extension needs to be registered as new file format. For this include PngImage in your uses and call this:

MyImage.Picture.RegisterFileFormat('thumb', 'PNG based thumbnails', TPngImage);

Later you can display the thumb file you like like this:

MyImage.Picture.LoadFromFile('d:\Pictures\Pictures.thumb');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM