The components on the "Dialogs" page of the Tool / Component Palette make the Windows standard dialog boxes available to your applications. The dialog boxes provide a consistent interface for file operations such as opening, saving, and printing files.
TOpenDialog, TSaveDialog and others inherit from TCommonDialog. Most dialogs expose the Title property you can use to specify the title / caption in the dialog’s title bar.
The TPrintDialog component displays a standard Windows dialog box for sending jobs to a printer.
Unfortunately, the TPrintDialog does not expose the Title property.
By handing the OnShow event of a print dialog you can specify the text for the dialog’s title bar:
//handles PrintDialog1.OnShow
procedure TReportForm.PrintDialog1Show(Sender: TObject) ;
begin
if Sender is TPrintDialog then
SetWindowText(
TPrintDialog(Sender).Handle,
'How do you want to print your report?') ;
end;
Note: a common dialog box opens when its Execute method is called.
本文介绍了如何使用Delphi中的TOpenDialog、TSaveDialog及TPrintDialog等组件来实现文件打开、保存及打印等标准对话框功能,并展示了如何通过设置Title属性及处理OnShow事件来自定义这些对话框的标题。
11万+

被折叠的 条评论
为什么被折叠?



