469,282 Members | 2,001 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

how to extend OpenFileDialog ?

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
Jul 31 '07 #1
9 4785
On Jul 31, 7:48 am, "Sagaert Johan" <REMOVEsagaer...@hotmail.com>
wrote:
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.

Jul 31 '07 #2
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 )
Because these classes aren't extensible (don't know why MSFT did it this
way) it's not trivial. Fortunately (in your case) this example does almost
precisely what you want. It helps if you have WinAPI experience however.

http://msdn2.microsoft.com/en-us/library/ms996463.aspx
Jul 31 '07 #3
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

"Sagaert Johan" <RE*************@hotmail.comwrote in message
news:%2******************@TK2MSFTNGP06.phx.gbl...
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

Jul 31 '07 #4
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Kevin Spencer" <un**********@nothinks.comwrote in message
news:e2**************@TK2MSFTNGP02.phx.gbl...
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

"Sagaert Johan" <RE*************@hotmail.comwrote in message
news:%2******************@TK2MSFTNGP06.phx.gbl...
>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


Jul 31 '07 #5
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)
Jul 31 '07 #6
Well that just blows. I'd still recommend deriving from CommonDialog at
least, and then making the API calls.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Larry Smith" <no_spam@_nospam.comwrote in message
news:O3*************@TK2MSFTNGP06.phx.gbl...
> 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)

Jul 31 '07 #7
Hi,

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

"Sagaert Johan" <RE*************@hotmail.comwrote in message
news:%2******************@TK2MSFTNGP06.phx.gbl...
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
Jul 31 '07 #8
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 [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:%2****************@TK2MSFTNGP04.phx.gbl...
Well that just blows. I'd still recommend deriving from CommonDialog
at least, and then making the API calls.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Larry Smith" <no_spam@_nospam.comwrote in message
news:O3*************@TK2MSFTNGP06.phx.gbl...
>> 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)


Jul 31 '07 #9
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]
- mv*@spam.guard.caspershouse.com

"Kevin Spencer" <un**********@nothinks.comwrote in message
news:OO**************@TK2MSFTNGP03.phx.gbl...
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 [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:%2****************@TK2MSFTNGP04.phx.gbl...
> Well that just blows. I'd still recommend deriving from CommonDialog
at least, and then making the API calls.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Larry Smith" <no_spam@_nospam.comwrote in message
news:O3*************@TK2MSFTNGP06.phx.gbl...
>>> 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)



Jul 31 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by bobrad | last post: by
4 posts views Thread by Nagachandra Sekhar Grandhi | last post: by
8 posts views Thread by e-mid | last post: by
6 posts views Thread by barbara_dave | last post: by
3 posts views Thread by Martijn Mulder | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.