OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
About the printer common dialog boxes

TPrintDialog displayed a modal print or a print setup dialog box for 16-bit applications.

For 32-bit applications, it displays a modal print or a page setup dialog. The print dialog box lets you print a document. The print setup dialog box lets you configure the printer and specify additional print job characteristics. The page setup dialog lets you specify page settings, such as margins, and paper orientation. You can also use TPrinter and TPrintout to provide support for printer dialog boxes. TPrintDialog uses the TPrintDialog::TData structure to initialize the dialog box with the user's printer options, such as the number of pages to print, the output device, and so on.

TPrintDialog::TData's members, described in the following table, let you control the appearance and behavior of the printer common dialog boxes:

TData memberTypeDescription
FromPageintThe first page of output, if the PD_PAGENUMS flag is specified. On input, it specifies the default first page. On output, it specifies the first page the user chose.
ToPageintThe last page of output, if the PD_PAGENUMS flag is specified. On input, it specifies the default last page number. On output, it specifies the last page number the user chose.
MinPageintThe fewest number of pages the user can choose.
MaxPageintThe largest number of pages the user can choose.
CopiesintThe number of copies to print. On input, the default number of copies. On output, the number of copies the user actually chose.

Example

In the following example, CmFilePrint executes a standard print job common dialog box and uses the information in TPrintDialog::TData to determine what to print. CmFilePrintSetup adds a flag to bring up the print setup dialog box automatically.

void TCanvas::CmFilePrint()
{
if (TPrintDialog(this, data).Execute() == IDOK)
// Use TPrinter and TPrintout to print the drawing
}
void TCanvas::CmFilePrintSetup()
{
static TPrintDialog::TData data;
data.Flags |= PD_PRINTSETUP;
if (TPrintDialog(this, data, 0).Execute() == IDOK)
// Print
}

See Also