delphi如何实现浏览文件夹  
官方Delphi 学习QQ群: 682628230(三千人)
频道

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;
推荐分享
图文皆来源于网络,内容仅做公益性分享,版权归原作者所有,如有侵权请告知删除!
 

Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号

执行时间: 6.3579218387604 seconds