Untuk mendapatkan ukuran suatu file mungkin bisa menggunakan code berikut ini :
Code lengkapnya seperti ini,yaitu dengan Function :
function FindFileSize(Filename:string):integer; var sr : TSearchRec; begin if FindFirst(filename,faAnyFile-faDirectory,sr) = 0 then Result := sr.Size else result := -1; FindClose(sr); end; function scGetSizeDescription(const IntSize : Int64) : String; begin if IntSize < 1024 then Result := IntToStr(IntSize)+' bytes' else begin if IntSize < (1024 * 1024) then Result := FormatFloat('####0.##',IntSize / 1024)+' Kb' else if IntSize < (1024 * 1024 * 1024) then Result := FormatFloat('####0.##',IntSize / 1024 / 1024)+' Mb' else Result := FormatFloat('####0.##',IntSize / 1024 / 1024 / 1024)+' Gb'; end; end;
untuk implementsinya adalah :
if OPD.Execute then //OpenPictureDialoge Image1.Picture.LoadFromFile(OPD.FileName); RzLabel29.Caption:='[ File Size : '+scGetSizeDescription((FindFileSize(OPD.FileName)))+' ]'Cuman segitu dan Sekian....
0 comments:
Post a Comment
Jangan Lupa Memberikan Komentar, Namun Tolong Agar Menggunakan Bahasa Yang BAIK dan SOPAN Terima Kasih...