windowsforms-devexpress-dot-xtraprinting-dot-link-6b219c57.md
Displays the standard Print dialog and prints the current document.
Namespace : DevExpress.XtraPrinting
Assembly : DevExpress.XtraPrinting.v25.2.dll
NuGet Package : DevExpress.Win.Printing
public void PrintDlg()
Public Sub PrintDlg
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.
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;
}
Imports DevExpress.XtraPrinting
Imports DevExpress.XtraGrid.Views.Grid
' ...
' Create printing components.
Private printingSystem1 As PrintingSystem = New PrintingSystem()
Private printableComponentLink1 As PrintableComponentLink = New PrintableComponentLink()
' ...
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) _
Handles MyBase.Load
' 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
End Sub
See Also