示例: procedure TForm1.Button1Click(Sender: TObject); var pMyFile:textfile; pStr : string; begin if OpenDialog1.Execute then begin Assignfile(pMyFile,OpenDialog1.FileName); Reset(pMyFile); while not Eof(pMyFile) do begin Readln(pMyFile,pStr);