gpt4 book ai didi

DELPHI - 如何使用 opendialog1 选择文件夹?

转载 作者:行者123 更新时间:2023-12-03 15:15:00 25 4
gpt4 key购买 nike

Possible Duplicate:
Delphi: Selecting a directory with TOpenDialog

我需要打开项目中的特定文件夹。当我使用opendialog1时,我只能打开一个文件。打开一个文件夹怎么样?

wanted - open folder dialog in Delphi

PS:我使用Delphi 2010

最佳答案

在 Vista 及更高版本上,您可以使用 IFileOpenDialog 显示更现代的对话框。

var
OpenDialog: TFileOpenDialog;
SelectedFolder: string;
.....
OpenDialog := TFileOpenDialog.Create(MainForm);
try
OpenDialog.Options := OpenDialog.Options + [fdoPickFolders];
if not OpenDialog.Execute then
Abort;
SelectedFolder := OpenDialog.FileName;
finally
OpenDialog.Free;
end;

看起来像这样:

enter image description here

关于DELPHI - 如何使用 opendialog1 选择文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9527762/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com