1. Home
  2. Computing & Technology
  3. Delphi Programming

Changing the Title of a Print Dialog in Delphi
Specifing TPrintDialog's Caption

By , About.com Guide

tprintdialog custom title

tprintdialog custom title

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.

TPrintDialog.Title

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 tips navigator:
» Delayed Event Handling Using Event Handler Detaching
« Generic Solution to Freeing Objects in Delphi's TStringList Collections

More Delphi Programming Quick Tips
Explore Delphi Programming
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. Delphi 2009 Tips
  7. Changing the Title of a Print Dialog in Delphi - Specifing TPrintDialog's Caption

©2010 About.com, a part of The New York Times Company.

All rights reserved.