delphi 选择文件夹,路径选择,浏览文件夹

选择文件夹,路径选择,

文件夹

资源管理器

推荐  SelectDirectory

 http://docwiki.embarcadero.com/Libraries/Seattle/en/Vcl.FileCtrl.TSelectDirFileDlgOpts

Vcl.FileCtrl.hpp

if (!SelectDirectory("请选择目录","",DaoPath))
{
return;
}

 

SelectDirectory

#include "FileCtrl.hpp"
 
const SELDIRHELP = 1000;
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  String Dir = "C:\\Program Files\\CodeGear";
  if (SelectDirectory(Dir, TSelectDirOpts() << sdAllowCreate << sdPerformCreate << sdPrompt,SELDIRHELP))
    Label1->Caption = Dir;
}

 

SHBrowseForFolder

http://bbs.csdn.net/topics/390017304

 

Vcl.Shell.ShellCtrls

TShellComboBox

TShellTreeView

TShellListView

 

文件名:

ShellListView1.Folders[ShellListView1.ItemIndex].PathName

ShellTreeView.SelectedFolder.PathName;

 

//2018.1.18

http://docwiki.embarcadero.com/Libraries/Tokyo/en/Vcl.FileCtrl.TSelectDirFileDlgOpts

能粘贴路径,选择路径,快速输入

procedure TForm.Button4Click(Sender: TObject);
var
  astrPath: tarray<string>; // 用户选定后的目录
begin
  //TSelectDirFileDlgOpt.sdHidePinnedPlaces
  if (SelectDirectory('请选择文件保存的路径', astrPath,  [sdNoDereferenceLinks])) then
  begin
    self.Caption := astrPath[0];
  end;

end;

 

 

 

 

procedure TForm.Button1Click(Sender: TObject);
const
  SELDIRHELP = 1000;
var
  Dir: string;
begin
  Dir := 'C:\Windows';
  if Vcl.FileCtrl.SelectDirectory(Dir, [sdAllowCreate, sdPerformCreate, sdPrompt], SELDIRHELP) then
    self.Caption := Dir;
end;

 

参考写的很细,学习

https://www.cnblogs.com/huangygdelphi/articles/1969357.html

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值