Delphi如何实现浏览文件夹


本文整理自网络,侵删。

 Delphi如何实现浏览文件夹

SelectDirectory函数(FileCtrl单元)
1、function SelectDirectory(const Caption: string; const Root: WideString; out Directory: string): Boolean; overload;
2、function SelectDirectory(var Directory: string; Options: TSelectDirOpts; HelpCtx: Longint): Boolean; overload;
注意:使用前请uses FileCtrl;
第1种调用格式示例为:
const
sCaption = '文件夹'; //弹出框标题名(非弹出框窗体名)
sRoot = ''; //初始文件夹(如'C:\','D:\DownLoad'等, 不存在则从桌面)
var
sDir: string;
begin
if SelectDirectory(sCaption, sRoot, sDir) then
//已返回所选文件夹路径给sDir,自行处理
end;
结果下图:


第2种调用格式示例为:
const
SELDIRHELP = 1000;
var
sDir: string; //初始文件夹(如'C:\','D:\DownLoad'等)
begin
sDir := '';
if SelectDirectory(Dir, [sdAllowCreate, sdPerformCreate, sdPrompt], SELDIRHELP) then
//已返回所选文件夹路径给sDir,自行处理
end;

相关阅读 >>

Delphi zlib 流压缩解压

Delphi 得到ip三个值

Delphi下获取系统默认的useragent的方法

Delphi 一个绘制虚线的非常规函数(常规方法,打印机上绘制不出虚线)

Delphi selectdirectory 选择文件夹

Delphi createmessagedialog

Delphi 计算imei的校验位

Delphi idtcp上传文件

Delphi android / ios应用程序中使用tgeocoder类进行反向地理编码(从位置信息中获取地址)

Delphi 生成指定范围和个数的不重复的随机整数

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...