Solved

Previewing an image in an TOpenDialog?

Posted on 2004-08-13
8
440 Views
Last Modified: 2010-04-05
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
Comment
Question by:wileyecoyote
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 7

Accepted Solution

by:
DavidBirch2dotCom earned 250 total points
ID: 11792147
try using OpenPictureDialog and SavePictureDialog on the dialogs toolbar
0
 
LVL 7

Expert Comment

by:DavidBirch2dotCom
ID: 11792154
TOpenPictureDialog and TSavePictureDialog its the same dialogue as you are talking about it will preview images for you
0
 

Author Comment

by:wileyecoyote
ID: 11792395
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
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 11792418
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 11792424
If it cannot display JPeG's then the image format is not registered in runtime.
0
 
LVL 14

Assisted Solution

by:Pierre Cornelius
Pierre Cornelius earned 50 total points
ID: 11793171
Simply add JPeg to your uses clause and your problem will be solved.

Regards

Pierre Cornelius
0
 
LVL 7

Expert Comment

by:DavidBirch2dotCom
ID: 11795191
thanks for the points :-)
0
 

Author Comment

by:wileyecoyote
ID: 11795210
Thanks guys. The combination of TOpenPictureDialog and JPeg addes to the use clause did the trick. Appreciate the help.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now