Re:Add Multiple Items to a ListView and get the size of the files in a ListView
Example:
procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
Item: TListItem;
F: TSearchRec;
begin
if OpenDialog1.Execute then
begin
for i := 0 to OpenDialog1.Files.Count - 1 do
begin
Item := ListView1.Items.Add;
Item.Caption := OpenDialog1.Files[i];
FindFirst(OpenDialog1.Files[i], faAnyFile, F);
if F.Size < 1000000 then
Item.SubItems.Text := FloatToStrF(F.Size / 1024, ffNumber, 5, 2) + '
kB'
else
Item.SubItems.Text := FloatToStrF(F.Size / 1048576, ffNumber, 5, 2)
+ ' MB';
FindClose(F);
end;
end;
end;
<jdenek...@my-deja.com> schreef in bericht
news:8v1f0b$u6d$1@nnrp1.deja.com...
Quote
> I like to add multiple selected files form an OpenDialog into a
> Listview How can i do this.
> And I also like to now how I can get the Size of all the files in the
> Listview and display it in lets say a label in kilobytes or if the size
> of the files exceed the 1 megabyte then display it as megabytes.
> I hope anyone can Help me with these questions.
> Sent via Deja.com http://www.deja.com/
> Before you buy.