Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 454
  • Last Modified:

Previewing an image in an TOpenDialog?

Hi,

I'm trying to create an image preview in a standard TOpenDialog, similar to the ones found in many image-editing programs like Paint Shop Pro. That is, the user clicks an image file in the filelist and the image shows a scaled down preview.

However, I'm unsure about how to go about this. Is it possible to easily incorporate this somehow in a standard TOpenDialog, and if so, how can this be accomplished?

Thanks!
0
wileyecoyote
Asked:
wileyecoyote
  • 3
  • 2
  • 2
  • +1
2 Solutions
 
DavidBirch2dotComCommented:
try using OpenPictureDialog and SavePictureDialog on the dialogs toolbar
0
 
DavidBirch2dotComCommented:
TOpenPictureDialog and TSavePictureDialog its the same dialogue as you are talking about it will preview images for you
0
 
wileyecoyoteAuthor Commented:
It appears that TOpenPictureDialog cannot display jpeg files, despite the fact that the filter does list jpeg as format. However, it crashes the application when I'm trying to. Unfortunately, it is essential for my application to preview jpeg files.

Can this be fixed?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Wim ten BrinkSelf-employed developerCommented:
If you don't like the TOpenPictureDialog/TSavePictureDialog then you're out of luck. In those cases you'd have to write your own dialogs as new forms in Delphi. The standard dialogs are just timesafers for generic solutions. If you want something specific, you have to create it yourself.

Now, for the preview you create a new form and drop the explorer components and other visual components that allow you to select drive/folder/file/mask/edit and whatever else. You also drop a TImage on this form and from http://www.delphi-gems.com/ you download GraphicEx so you can support all kinds of formats. Then, whenever the user selects a file, you try to show it in the TImage. On success, great. On failure you'll get an exception that you silently ignore.

It's a pain to have to do this but many others are doing this in sililar ways. It's easier than trying to modify the existing dialogs...
0
 
Wim ten BrinkSelf-employed developerCommented:
If it cannot display JPeG's then the image format is not registered in runtime.
0
 
Pierre CorneliusCommented:
Simply add JPeg to your uses clause and your problem will be solved.

Regards

Pierre Cornelius
0
 
DavidBirch2dotComCommented:
thanks for the points :-)
0
 
wileyecoyoteAuthor Commented:
Thanks guys. The combination of TOpenPictureDialog and JPeg addes to the use clause did the trick. Appreciate the help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now