No me acuses de no preferir la POO, pero para algo como esto, no hace falta un componente...
Alguna vez hice algo como esto, que ahora se me ocurre:
Código Delphi
[-]
function BytesToStr(const Bytes: Int64): string;
Const
KB = 1024;
MB = 1024 * KB;
GB = 1024 * MB;
TB = 1024.0 * GB;
var
Valor: Double;
Unidad: string;
Decimales: Byte;
begin
Decimales := 2;
if Bytes < KB then
begin
Valor := Bytes;
Unidad := 'Bytes';
Decimales := 0;
end
else if Bytes < MB then
begin
Valor := Bytes / KB;
Unidad := 'KB';
end
else if Bytes < GB then
begin
Valor := Bytes / MB;
Unidad := 'MB';
end
else if Bytes < TB then
begin
Valor := Bytes / GB;
Unidad := 'GB';
end
else
begin
Valor := Bytes / TB;
Unidad := 'TB';
end;
Result := Format('%.*f %s', [Decimales, Valor, Unidad]);
end;
Hasta luego.