Back to Devexpress

PrintTool.PrintDialog(UserLookAndFeel) Method

windowsforms-devexpress-dot-xtraprinting-dot-printtool-dot-printdialog-x28-devexpress-dot-lookandfeel-dot-userlookandfeel-x29.md

latest3.9 KB
Original Source

PrintTool.PrintDialog(UserLookAndFeel) Method

Runs the Print dialog to select a printer, specify the print options (number of copies, page range, and paper source) and print the document.

Namespace : DevExpress.XtraPrinting

Assembly : DevExpress.XtraPrinting.v25.2.dll

NuGet Package : DevExpress.Win.Printing

Declaration

csharp
public bool? PrintDialog(
    UserLookAndFeel lookAndFeel
)
vb
Public Function PrintDialog(
    lookAndFeel As UserLookAndFeel
) As Boolean?

Parameters

NameTypeDescription
lookAndFeelUserLookAndFeel

A UserLookAndFeel object, specifying the look-and-feel settings applied to the Print dialog.

|

Returns

TypeDescription
Nullable<Boolean>

true if the user clicks Print in the dialog box; false if the user clicks Cancel ; otherwise null ( Nothing in Visual Basic).

|

Remarks

The following image illustrates the Print dialog that is invoked by this method and replaces the standard PrintDialog.

If a document has not been created prior to calling the PrintDialog method, the PrintDialog internally calls the Link.CreateDocument method.

To obtain the document after it is generated, use the PrintingSystemBase.Document property of the PrintToolBase.PrintingSystem.

Note

Changing page settings in the Print Dialog does not recreate the current document and affects only the printing result.

Example

To make the PrintTool.PrintDialog method invoke the standard system Print dialog, add the following code to the application’s Program.cs unit ( Program.vb in Visual Basic).

This will replace the DefaultPrintDialogRunner, returned by the PrintDialogRunner.Instance property, with a SystemPrintDialogRunner.

csharp
using DevExpress.XtraPrinting.Preview;
// ...

static void Main(string[] args) {
    PrintDialogRunner.Instance = new SystemPrintDialogRunner();
    // ...
}
vb
Imports DevExpress.XtraPrinting.Preview
' ...

Partial Friend Class MyApplication
    <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
    Public Sub New()
        ' ...
        PrintDialogRunner.Instance = New SystemPrintDialogRunner()
    End Sub
' ...
End Class

See Also

ShowPageSetup()

PrintTool Class

PrintTool Members

DevExpress.XtraPrinting Namespace