Back to Devexpress

PrintTool Class

windowsforms-devexpress-dot-xtraprinting-7ded77b1.md

latest2.9 KB
Original Source

PrintTool Class

The base class for the ReportPrintTool class.

Namespace : DevExpress.XtraPrinting

Assembly : DevExpress.XtraPrinting.v25.2.dll

NuGet Package : DevExpress.Win.Printing

Declaration

csharp
[DXLicenseWinReporting]
public class PrintTool :
    PrintToolBase,
    IDisposable
vb
<DXLicenseWinReporting>
Public Class PrintTool
    Inherits PrintToolBase
    Implements IDisposable

Remarks

The PrintTool class exposes the PrintToolBase.PrintingSystem property that allows you to access a Print Tool’s printing options, and the PrintTool.PreviewForm and PrintTool.PreviewRibbonForm properties that provide access to the options of its Print Preview form.

Example

This example shows how you can print a Windows Forms control (e.g. GridControl) using PrintTool.

csharp
using System;
using System.Windows.Forms;
using DevExpress.XtraPrinting;
// ...
private void simpleButton1_Click(object sender, EventArgs e) {
    PrintableComponentLink componentLink = new PrintableComponentLink(new PrintingSystem());
    componentLink.Component = gridControl1;
    componentLink.CreateDocument();
    PrintTool pt = new PrintTool(componentLink.PrintingSystemBase);
    pt.ShowPreviewDialog();
}
vb
Imports System
Imports System.Windows.Forms
Imports DevExpress.XtraPrinting
' ...
Private Sub simpleButton1_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles simpleButton1.Click
    Dim componentLink As New PrintableComponentLink(New PrintingSystem())
    componentLink.Component = gridControl1
    componentLink.CreateDocument()
    Dim pt As New PrintTool(componentLink.PrintingSystemBase)
    pt.ShowPreviewDialog()
End Sub

Inheritance

Object PrintToolBase PrintTool LinkPrintTool

ReportPrintTool

See Also

PrintTool Members

ReportPrintTool

DevExpress.XtraPrinting Namespace