Back to Devexpress

PrintTool.PreviewForm Property

windowsforms-devexpress-dot-xtraprinting-dot-printtool-a54c6e09.md

latest2.8 KB
Original Source

PrintTool.PreviewForm Property

Provides access to a Print Preview form of the PrintTool.

Namespace : DevExpress.XtraPrinting

Assembly : DevExpress.XtraPrinting.v25.2.dll

NuGet Package : DevExpress.Win.Printing

Declaration

csharp
public PrintPreviewFormEx PreviewForm { get; }
vb
Public ReadOnly Property PreviewForm As PrintPreviewFormEx

Property Value

TypeDescription
PrintPreviewFormEx

A PrintPreviewFormEx object.

|

Example

The example below illustrates how to define a document scale factor in the Print Preview.

csharp
using System;
using System.Windows.Forms;
using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
using DevExpress.XtraPrinting.Preview;
// ...

private void button1_Click(object sender, EventArgs e) {
    ReportPrintTool printTool = new ReportPrintTool(new XtraReport1());
    printTool.PreviewForm.Load += new EventHandler(PreviewForm_Load);
    printTool.ShowPreviewDialog();
}

void PreviewForm_Load(object sender, EventArgs e) {
    PrintPreviewFormEx frm = (PrintPreviewFormEx)sender;
    frm.PrintingSystem.ExecCommand(PrintingSystemCommand.Scale, new object[] { 0.7f });
}
vb
Imports System
Imports System.Windows.Forms
Imports DevExpress.XtraPrinting
Imports DevExpress.XtraReports.UI
Imports DevExpress.XtraPrinting.Preview
' ...

Private Sub button1_Click(ByVal sender As Object, _ 
ByVal e As EventArgs) Handles button1.Click
    Dim printTool As New ReportPrintTool(New XtraReport1())
    AddHandler printTool.PreviewForm.Load, AddressOf PreviewForm_Load
    printTool.ShowPreviewDialog()
End Sub

Private Sub PreviewForm_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim frm As PrintPreviewFormEx = CType(sender, PrintPreviewFormEx)
    frm.PrintingSystem.ExecCommand(PrintingSystemCommand.Scale, New Object() { 0.7f })
End Sub

See Also

PreviewRibbonForm

PrintTool Class

PrintTool Members

DevExpress.XtraPrinting Namespace