1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24:
| const iKByte=1024; iMByte=1024*iKByte; iGByte=1024*iMByte;
type TByteFormat(bf_Byte, bf_KByte, bf_MByte, bf_GByte);
function FormatByte(const aSize:Extended; aFmt:TByteFormat):String; begin case aFmt of bf_Byte :Result:=FormatFloat(aSize, '#,#0 Byte'); bf_KByte:Result:=FormatFloat(aSize/iKByte, '#,#0.00 KB'); bf_MByte:Result:=FormatFloat(aSize/iMByte, '#,#0.00 MB'); bf_GByte:Result:=FormatFloat(aSize/iGByte, '#,#0.00 GB'); else Result:=FormatFloat(aSize, '#,#0 Byte'); end; end; ... ... Label1.Caption:='Frei: '+FormatByte(free_size, bf_MGyte); Label2.Caption:='Belegt: '+FormatByte(total_size-free_size, bf_MByte); ... |