浏览对话框选择 [英] Browse dialog selection

查看:70
本文介绍了浏览对话框选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想加载以前选择的浏览对话框。
打开浏览对话框的
它应该带有之前的选择文件夹/文件..



可以帮助我解决这个问题。

I wanted to load the browse dialog with previous selection.
on opening the browse dialog it should come with previous selection folder/file..

can any one help me regarding this.

推荐答案

你可以使用CFileDialog来实现这一目的。:)

有关相同的更多信息,您可以浏览msdn的以下链接。

CFileDialog [ ^ ]

或者更好地参考你的msdn。



现在问题仍然是你需要以前的目录!!!。

为此,

CFileDialog在打开时默认打开CurrentDirectory。

如果你检查你的CFileDialog模态之前的意思

GetCurrentDirectory()

函数您将获得CFileDialog引用的一条路径相同的路径。



之后,无论如何,如果你改变当前目录,你会在CFileDialog中获得更新路径。

CurrentDirectory可以双向改变。

1)如果你调用SetCurrentDirectory。

2)并且CFileDialog也将所选路径更改为当前目录。



所以你的解决方案是,

1)永远不要更改currentDirectory







2)在调用CFileDialog之前,最好使字符串变量存储目录路径和setDirectory。

;)

希望它能为你工作..



如果您在谈论文件夹树浏览对话框,那么是,

不可能设置路径。

因为它显示默认情况下,桌面路径为currentDirectory。
fist of all you can use CFileDialog to do so.:)
for more information on same you may go throught following link of msdn.
CFileDialog[^]
Or better refer your msdn.

Now question remain about you need previous directory!!!.
To do so,
CFileDialog open by default CurrentDirectory when it is open.
Means before modal of your CFileDialog if you check
GetCurrentDirectory()
Function you will get one path same path refered by CFileDialog to open.

after that, in any case if you change the current directory you get updated path in CFileDialog.
CurrentDirectory can be change two way.
1)if you call SetCurrentDirectory.
2)And CFileDialog also changes selected path as current directory.

So your solution is that,
1)Never change currentDirectory

Or

2)Better Make on String Variable to store directory path and setDirectory before calling CFileDialog.
;)
Hope it will work for you..

And Yes if you talking about Folder Tree browse dialog then there ,
Not possiblility about setting path.
Because it shows by default Desktop path as currentDirectory.


试试这个:

Try this:
folderBrowser.SelectedPath = "yourpath";


这篇关于浏览对话框选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆