TOpenDialog/zh CN
English · Français · Русский · 中文(中国)
TOpenDialog
就是打开文件的弹窗,在 Dialogs tab 的 Component Palette.
procedure TForm1.Button1Click(Sender: TObject);
var
s:String;
begin
try
OpenDialog1.Execute;
s := OpenDialog1.FileName;
Form1.Caption := s;
Memo1.Lines.LoadFromFile(s);
except
on E: Exception do
//ShowMessage( 'Error: '+ E.ClassName + #13#10 + E.Message );
ShowMessage('忘记选择文件或者选择的文件不存在');
end;
end;参考资料
From the Free Pascal wiki, page "TOpenDialog/zh CN", as it stood on 2020-05-06 after a change by FTurtle, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.