472,328 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

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 4963
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: bobrad | last post by:
MAYBE SOMEBODY CAM HELP I AM USING THE FOLLOWING CODE TO GET A LOCATION OF A FILE IN A WINFORM DIALOG OpenFileDialog openFileDialog = new...
2
by: don | last post by:
has anyone experienced problems with interactions between OpenFileDialog and FileStream? When I select "open" from an OpenFileDialog the subsequent...
4
by: Nagachandra Sekhar Grandhi | last post by:
I am facing a problem with OpenFileDialog. It is as follows. I opened OpenFileDialog dialog box and selected a folder in it. After selecting the...
8
by: e-mid | last post by:
why does not openFileDialog have closed event? i want to do something; as soon as the dialog closes. is there a way to do this?
6
by: barbara_dave | last post by:
Hi, All, I want to use the openfiledialog to open different extension files in different directory( only one type files at one time). I set the...
8
by: marcus.kwok | last post by:
I am having a weird problem and I have can't figure out why it is happening. I create an OpenFileDialog and set a filename filter. When the...
1
by: sam | last post by:
OpenFileDialog appears to be "holding onto" the parent folder of a selected file until the application using the dialog quits. After creating a...
3
by: Martijn Mulder | last post by:
It strikes me that System.Windows.Forms.OpenFileDialog seems te 'remember' which directory it was in last, even when a new OpenFileDialog-object is...
0
by: mbewers1 | last post by:
Hi I'm having a problem trying to get a customised OpenFileDialog() to fulfil my requirements. The code for this custom-built dialog has been...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.