Вообще использую виртуальный режим.
FIDLISTLEFT - типа TList, в котором хранится списки файлов.
| Код | procedure TMain.ListViewLeftData(Sender: TObject; Item: TListItem); var Attrs: string; NameFIle : String; Exs : string; P : integer; begin if (Item.Index > FIDListLeft.Count) then Exit; with ShellItem(Item.Index, FIDListLeft)^ do begin if IsFolder(FIShellFolderAAA, ID) then Item.Caption := Format('[%s]',[DisplayName]) else Begin NameFIle := DisplayName; Exs := ExtractFileExt(NameFIle);
P := pos(exs, NameFile ); Delete (NameFile,P , Length(NameFile)); Item.Caption := NameFIle; end;
If Item.Caption = '' then begin Item.Caption := '[..]'; Item.ImageIndex := ImageIndex; Item.SubItems.Add(''); item.SubItems.Add('<папка>'); end Else BEGIN Item.ImageIndex := ImageIndex;
If IsFolder(FIShellFolderAAA, ID) then Item.SubItems.Add('') else Item.SubItems.Add(Extension );
if not IsFolder(FIShellFolderAAA, ID) then Item.SubItems.Add( FloatToStr(Size) + ' '+ SizeBKBMBGMTM) else Item.SubItems.Add('<папка>'); try Item.SubItems.Add(ModDate); except end;
if Bool(Attributes and FILE_ATTRIBUTE_READONLY) then Attrs := Attrs + 'r' else Attrs := Attrs + '-'; if Bool(Attributes and FILE_ATTRIBUTE_HIDDEN) then Attrs := Attrs + 'h' else Attrs := Attrs + '-'; if Bool(Attributes and FILE_ATTRIBUTE_SYSTEM) then Attrs := Attrs + 's' else Attrs := Attrs + '-'; if Bool(Attributes and FILE_ATTRIBUTE_ARCHIVE) then Attrs := Attrs + 'a' else Attrs := Attrs + '-';
end; Item.SubItems.Add(Attrs); END;
end;
|
|