关于ShellListView控件的使用(100分)

  • 主题发起人 疾风之猫
  • 开始时间

疾风之猫

Unregistered / Unconfirmed
GUEST, unregistred user!
delphi6控件组Samples里有一个ShellListView控件,据说可以显示目录里的文件列表,
但是我用了caption:=ShellListView.selected.caption,却显示不出当前选择的文件名,
请问怎么取得?还有当Mulitselect属性为True时,又怎么得到选择的文件名?
 
1.
caption:=ShellListView.selected.[red]caption[/red]
改成:
caption:=ShellListView.selected.[red]text[/red]
试试。
2.
要在ShellListView.selections中循环,检查selected属性。
 
var
li:TListItem;
sf:TshellFolder;
begin
li:=shView.Selected;
while li<>nil do
begin
sf:=shview.Folders[li.index];
with listview1.Items.Add do
begin
if not sf.IsFolder then
begin
caption:=extractfilepath(sf.PathName);
imageindex:=sf.ImageIndex(true);
end;
end;
li:=shview.GetNextItem(li,sdall,[isselected]);
end;
 
并不需要函数:
extractfilepath()
这样就行了
 
顶部