用什么函数,简单实例...

解决方案 »

  1.   

    在form中放一个opendialog,一个button,在button的OnClick事件中编写如下代码即可:procedure TForm1.Button1Click(Sender: TObject);
    Var
      theFile:file of byte;
      size:LongInt;
    begin
    if opendialog1.Execute then
    begin
    assignfile(theFile,opendialog1.FileName);
    reset(theFile);
    size:=filesize(theFile);
    showmessage('文件大小:'+format('%s%d Byte%s即:%fKB%s%d bits',[#13,size,#13,size/1024,#13,size*8]));
    closefile(theFile);
    end;
    end;