各位大虾帮帮忙,小D先谢过了!

Sir_Java 2003-10-20 01:44:18
怎样将一个磁盘中的所有文件及文件夹显示在一个ListView控件中,包括图标,即实现类似资源管理器中右边窗口的功能?
请详细说明,最好有一段代码为例,我是菜鸟!分不是问题!
...全文
29 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
Sir_Java 2003-10-21
  • 打赏
  • 举报
回复
我要用的是ListView控件!
superlionet 2003-10-20
  • 打赏
  • 举报
回复
delphi5 中没有吗?那就用delphi6 或者在win31页里用filelistbox,directorylistbox,drivecombobox组合使用,也应该可以达到你想要的结果的。
Sir_Java 2003-10-20
  • 打赏
  • 举报
回复
ShellTreeView、ShellComboBox这两个组件在D5里面可以用吗?如果可以,这两个控件在何处可以下载到?
Sir_Java 2003-10-20
  • 打赏
  • 举报
回复
不好意思,我用的是D5!Samples页面没有你们所说的控件,
我的邮箱地址是:xazhengyuning@163.com!
谢谢各位了!
hansome 2003-10-20
  • 打赏
  • 举报
回复
在面板的Samples页
有个 ShellListView 组件非常适合你
还有相关的
ShellTreeView、ShellComboBox组件

使用起来非常方便和简单
pankun 2003-10-20
  • 打赏
  • 举报
回复
转:

查找所有文件
procedure findall(disk,path: String; var fileresult: Tstrings);
var

fpath: String;

fs: TsearchRec;

begin

fpath:=disk+path+'\*.*';

if findfirst(fpath,faAnyFile,fs)=0 then

begin

if (fs.Name<>'.')and(fs.Name<>'..') then

if (fs.Attr and faDirectory)=faDirectory then

findall(disk,path+'\'+fs.Name,fileresult)

else

fileresult.add(disk+strpas(strupper(pchar(path)))+'\'+strpas(

strupper(pchar(fs.Name)))+'('+inttostr(fs.Size)+')');

while findnext(fs)=0 do

begin

if (fs.Name<>'.')and(fs.Name<>'..') then

if (fs.Attr and faDirectory)=faDirectory then

findall(disk,path+'\'+fs.Name,fileresult)

else

fileresult.add(disk+strpas(strupper(pchar(path)))+'\'+str

pas(strupper(pchar(fs.Name)))+'('+inttostr(fs.Size)+')');

end;

end;

findclose(fs);

end;

procedure DoSearchFile(Path: string; Files: TStrings = nil);

var

Info: TSearchRec;

procedure ProcessAFile(FileName: string);

begin

if Assigned(PnlPanel) then

PnlPanel.Caption := FileName;

Label2.Caption := FileName;

end;

function IsDir: Boolean;

begin

with Info do

Result := (Name <> '.') and (Name <> '..') and ((attr and fadirectory) = fadirectory);

end;

function IsFile: Boolean;

begin

Result := not ((Info.Attr and faDirectory) = faDirectory);

end;

begin

Path := IncludeTrailingBackslash(Path);

try

if FindFirst(Path + '*.*', faAnyFile, Info) = 0 then

if IsFile then

ProcessAFile(Path + Info.Name)

else if IsDir then DoSearchFile(Path + Info.Name);

while FindNext(Info) = 0 do

begin

if IsDir then

DoSearchFile(Path + Info.Name)

else if IsFile then

ProcessAFile(Path + Info.Name);

Application.ProcessMessages;

if QuitFlag then Break;

Sleep(100);

end;

finally

FindClose(Info);

end;

end;

 

lincanwen 2003-10-20
  • 打赏
  • 举报
回复
看看 Samples中的ShellListView控件,应该可以满足你的要求。
EastBuBai 2003-10-20
  • 打赏
  • 举报
回复
给我留个地址我给你发个程序吧
Delphi_Li 2003-10-20
  • 打赏
  • 举报
回复
你看看Delphi提供的源代码!!!

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧