how to extend OpenFileDialog ?

S

Sagaert Johan

Hi
Can i extend the OpenFileDialog so i can show a thumbnail of a picture i am
opening ?
(priview it in a picturebox inside the fileopen dialog )

Johan
 
Z

zacks

Hi
Can i extend the OpenFileDialog so i can show a thumbnail of a picture i am
opening ?
(priview it in a picturebox inside the fileopen dialog )

Johan

If someone knows how to do this programmatically, ie, preset the
selection for the View Menu, I'd like to hear it.

But there is an old fashioned manual way. When the open file dialog is
open, click on the View Menu toolbar button and select Thumbnails from
the drop down.
 
K

Kevin Spencer

No, the OpenFileDialog is not inheritable. Your best bet would be to create
your own dialog from a Windows Form.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
N

Nicholas Paldino [.NET/C# MVP]

I would disagree with this. While the OpenFileDialog class is not
inheritable, the FileDialog class which it inherits from is. I would say
that it would be better to at least inherit from that, and then work from
there.
 
L

Larry Smith

I would disagree with this. While the OpenFileDialog class is not
inheritable, the FileDialog class which it inherits from is. I would say
that it would be better to at least inherit from that, and then work from
there.

You can't do that either (read the "Remarks" section for "FileDialog").
Ultimately you have to wrap "GetOpenFileName()" in the WinAPI. The link I
provided in my first post is by a MSFT consultant who demonstrates how to do
this. Again though, it's still tough going unless you have a WinAPI
background (and even then it's low-level work)
 
N

Nicholas Paldino [.NET/C# MVP]

Well that just blows. I'd still recommend deriving from CommonDialog at
least, and then making the API calls.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Unfortunatelly the class is sealed, it means you cannot extend it.
Of course you can always create your own :)
 
K

Kevin Spencer

Hi Nicholas,

I checked all of this out, prior to answering. Yes, it's possible to inherit
CommonDialog and make API calls, but that's a lot of work for a small
performance gain. Note that I did not say that he SHOULD use a Windows Form,
but I recommended it as his "best bet." That was an opinion, of course. I
have found that it is often necessary to balance productivity with
performance, which is, of course, what the .Net Framework is all about. But
your opinion is as valid as mine, all things considered.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

Nicholas Paldino said:
Well that just blows. I'd still recommend deriving from CommonDialog
at least, and then making the API calls.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Larry Smith said:
You can't do that either (read the "Remarks" section for "FileDialog").
Ultimately you have to wrap "GetOpenFileName()" in the WinAPI. The link I
provided in my first post is by a MSFT consultant who demonstrates how to
do this. Again though, it's still tough going unless you have a WinAPI
background (and even then it's low-level work)
 
N

Nicholas Paldino [.NET/C# MVP]

Of course, I never meant it to be taken otherwise. I don't think there
is any performance gain to be had from deriving from CommonDialog, I just
think it is "cleaner" from a framework point of view.

I wouldn't hold it against anyone for just wrapping this up in their own
class/method and not deriving from CommonDialog.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Kevin Spencer said:
Hi Nicholas,

I checked all of this out, prior to answering. Yes, it's possible to
inherit CommonDialog and make API calls, but that's a lot of work for a
small performance gain. Note that I did not say that he SHOULD use a
Windows Form, but I recommended it as his "best bet." That was an opinion,
of course. I have found that it is often necessary to balance productivity
with performance, which is, of course, what the .Net Framework is all
about. But your opinion is as valid as mine, all things considered.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

Nicholas Paldino said:
Well that just blows. I'd still recommend deriving from CommonDialog
at least, and then making the API calls.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Larry Smith said:
I would disagree with this. While the OpenFileDialog class is not
inheritable, the FileDialog class which it inherits from is. I would
say that it would be better to at least inherit from that, and then
work from there.

You can't do that either (read the "Remarks" section for "FileDialog").
Ultimately you have to wrap "GetOpenFileName()" in the WinAPI. The link
I provided in my first post is by a MSFT consultant who demonstrates how
to do this. Again though, it's still tough going unless you have a
WinAPI background (and even then it's low-level work)
 
A

Alexander Petrov

Hi,

You can use our Dialog Workshop .NET Components:
Please take a look: http://www.componentage.com

Powerful dialog components allow you to extend Windows Common
dialogs without writing a line of code. For example, you can add preview
pane in your Open/Save dialog s within 10 minuties (see demo video on the
site)! Each common dialog can be extended in many ways:
- Add your own Windows Form containing your own controls (preview control,
options, etc.) to the dialog window at run-time or at design-time using
Dialog Designer;
- Customize dialog's title, icon, position, etc;
- Control dialog's behaviour using many new events which do not exist in
original WinForms dialog components;
- Dialog Designer and design-time preview;

Exclusive Open/Save dialogs features: integrated MRU files list (like in VB6
IDE); customizable file list view and Places Bar controls, Drop-down menu
for OK button, more features for working with FTP folders, etc. You can
disable rename/delete commands, do not allow to navigate to specific
folders, select folders only instead of files, etc.

Special ModelessDialog component allows you to use each dialog as modeless
window, without locking other application windows. Specifically, you can
put dialogs on your Windows Form as any other Windows Form control.

Best regards,
Alexander
www.componentage.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top