vcl-dxprndlg-dot-tdxprintdialog-fed40ff9.md
Displays the Print dialog.
function Execute: Boolean;
| Type | Description |
|---|---|
| Boolean | True |
If a user closed the Print dialog and confirmed pending changes.
Tip
A click on the Print button within the displayed dialog has no predefined effect. Call custom print-related commands in your code if the Execute function returns True (as demonstrated in the code example below).
FalseIf a user closed the Print dialog and discarded pending changes. |
Call the Execute function to display the custom Print dialog.
Unlike the Print dialog available for the TdxComponentPrinter component, the displayed Print dialog has no built-in print functionality. For example, the Page Setup… button is disabled if the OnPageSetup event is not handled.
The following code example displays the Print dialog and prints control content using the current report link:
uses
dxPSCore, // Declares the TdxComponentPrinter class
dxPrnDlg; // Declares the TdxPrintDialog component
// ...
procedure TMyForm.dxSpreadSheetShowPrintFormExecute(Sender: TObject);
begin
if dxPrintDialog1.Execute() then // Displays the Print dialog
dxComponentPrinter1.Print(False, nil); // Prints content using the current report link
end;
#include "dxPSCore.hpp" // Declares the TdxComponentPrinter class
#include "dxPrnDlg.hpp" // Declares the TdxPrintDialog component
// Add the following linker directives to the corresponding CPP source file:
#pragma link "dxPSCore" // Required to use dxPSCore.hpp declarations
#pragma link "dxPrnDlg" // Required to use dxPrnDlg.hpp declarations
void __fastcall TMyForm::dxSpreadSheetShowPrintFormExecute(TObject *Sender)
{
if(dxPrintDialog1->Execute()) // Displays the Print dialog
dxComponentPrinter1->Print(false, nullptr); // Prints content using the current report link
}
See Also