Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Link.PrintDlg() Method

Displays the standard Print dialog and prints the current document.

Namespace: DevExpress.XtraPrinting

Assembly: DevExpress.XtraPrinting.v24.2.dll

NuGet Package: DevExpress.Win.Printing

#Declaration

public void PrintDlg()

#Remarks

This method displays the standard Print dialog that allows an end-user to print the document, as well as (if required) select the printer, specify the range of pages to print, the number of copies, etc.

#Example

The following code demonstrates how to create a PrintableComponentLink, add it to the PrintingSystem.Links collection, adjust its printing settings, and use it to print an existing GridControl. Use the grid’s OptionsPrint property to customize its printing settings.

using DevExpress.XtraPrinting;
using DevExpress.XtraGrid.Views.Grid;
// ...

// Create printing components.
PrintingSystem printingSystem1 = new PrintingSystem();
PrintableComponentLink printableComponentLink1 = new PrintableComponentLink();
// ...

private void Form1_Load(object sender, EventArgs e) {
    // Add the link to the printing system's collection of links.
    printingSystem1.Links.AddRange(new object[] { printableComponentLink1 });

    // Assign a control to be printed by this link.
    printableComponentLink1.Component = gridControl1;

    // Assign the printing system to the document viewer.
    documentViewer1.PrintingSystem = printingSystem1;
}
See Also