Changing the Title of a Print Dialog in Delphi

本文介绍了如何使用Delphi中的TOpenDialog、TSaveDialog及TPrintDialog等组件来实现文件打开、保存及打印等标准对话框功能,并展示了如何通过设置Title属性及处理OnShow事件来自定义这些对话框的标题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值