TImagelist ( fore ), TImagelist TListviews LargeImages, .
procedure TForm2.Button1Click(Sender: TObject);
var li:TListItem;
SR: TSearchRec;
begin
FileList.Items.BeginUpdate;
try
FileList.Items.Clear;
FindFirst(ExtractFilePath(Application.ExeName) +'*.*', faAnyFile, SR);
try
repeat
li := FileList.Items.Add;
li.Caption := SR.Name;
if ((SR.Attr and faDirectory) <> 0) then li.ImageIndex := 1
else li.ImageIndex := 0;
until (FindNext(SR) <> 0);
finally
FindClose(SR);
end;
finally
FileList.Items.EndUpdate;
end;
end;
, TImageList ExtractFileExt (SR.Name),
if ((SR.Attr and faDirectory) <> 0) then li.ImageIndex := 1
else if lowercase(ExtractFileExt(SR.Name)) = '.png' then li.ImageIndex := 2
else if lowercase(ExtractFileExt(SR.Name)) = '.pdf' then li.ImageIndex := 3
else li.ImageIndex := 0;