Back to Devexpress

ProgressReflector Class

corelibraries-devexpress-dot-xtraprinting-7cb0f3ac.md

latest6.2 KB
Original Source

ProgressReflector Class

Reflects the current state of document printing or exporting.

Namespace : DevExpress.XtraPrinting

Assembly : DevExpress.Printing.v25.2.Core.dll

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
public class ProgressReflector
vb
Public Class ProgressReflector

The following members return ProgressReflector objects:

Remarks

Normally, this class is intended to reflect the state of a document’s printing or exporting processes currently being carried out in the PrintingSystem.

Important

The Reporting Subscription ships with pre-built Print Preview and End-User Report Designer controls for multiple platforms. You can use their public API in some customization scenarios that require changing the behavior or appearance of the control. To add additional DevExpress UI controls (for example, new panels, buttons, or menus) that are not part of the Reporting product, either on a form, web page, or within the Reporting UI, you need a subscription that includes those controls: WinForms , WPF , or ASP.NET Blazor. Note that all required platform-specific capabilities are included in our best-value bundle subscriptions: DXperience and Universal.

You can manually create an instance of the DevExpress.XtraPrinting.Native.ReflectorBar class with the specified ProgressBarControl and assign it to the PrintingSystemBase.ProgressReflector property. As a result, the ProgressBarControl will display the current state of any printing or exporting process. After you’ve finished working with the ProgressReflector , call the PrintingSystemBase.ResetProgressReflector method.

Note

The ProgressReflector class is intended to be used only with the documents created with the XtraReports Suite.

Example

This example illustrates how to use the ProgressReflector class (this class is intended to be used only with the documents created with the XtraReports Suite).

The following code invokes a form that contains the ProgressBarControl showing the document generation status. When the document creation is complete, the Progress Bar is hidden and the form shows a print preview.

csharp
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraPrinting;
using DevExpress.XtraPrinting.Native;
// ...

private void Form1_Load(object sender, EventArgs e) {
    // Create a report and make it
    // a document source of the document viewer.
    report = new XtraReport1();
    documentViewer1.DocumentSource = report;

    // Create a form to show a progress bar,
    // and adjust its properties.
    Form form = new Form() {
        FormBorderStyle = FormBorderStyle.None,
        Size = new System.Drawing.Size(300, 25),
        ShowInTaskbar = false,
        StartPosition = FormStartPosition.CenterScreen,
        TopMost = true
    };

    // Create a ProgressBar along with its ReflectorBar.
    ProgressBarControl progressBar = new ProgressBarControl();
    ReflectorBar reflectorBar = new ReflectorBar(progressBar);

    // Add a progress bar to a form and show it.
    form.Controls.Add(progressBar);
    progressBar.Dock = DockStyle.Fill;
    form.Show();

    try {
        // Register the reflector bar, so that it reflects
        // the state of a ProgressReflector.
        report.PrintingSystem.ProgressReflector = reflectorBar;
        report.CreateDocument();
    }
    finally {
        // Unregister the reflector bar, so that it no longer
        // reflects the state of a ProgressReflector.
        report.PrintingSystem.ResetProgressReflector();
        form.Close();
        form.Dispose();
    }
}
vb
Imports System.Windows.Forms
Imports DevExpress.XtraEditors
Imports DevExpress.XtraPrinting
Imports DevExpress.XtraPrinting.Native
' ...

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
    ' Create a report and make it
    ' a document source of the document viewer.
    report = New XtraReport1()
    documentViewer1.DocumentSource = report

    ' Create a form to show a progress bar,
    ' and adjust its properties.
    Dim form As New Form()
        form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
        form.Size = New System.Drawing.Size(300, 25)
        form.ShowInTaskbar = False
        form.StartPosition = FormStartPosition.CenterScreen
        form.TopMost = True

    ' Create a ProgressBar along with its ReflectorBar.
    Dim progressBar As New ProgressBarControl()
    Dim reflectorBar As New ReflectorBar(progressBar)

    ' Add a progress bar to a form and show it.
    form.Controls.Add(progressBar)
    progressBar.Dock = DockStyle.Fill
    form.Show()

    Try
        ' Register the reflector bar, so that it reflects
        ' the state of a ProgressReflector.
        report.PrintingSystem.ProgressReflector = reflectorBar
        report.CreateDocument()
    Finally
        ' Unregister the reflector bar, so that it no longer
        ' reflects the state of a ProgressReflector.
        report.PrintingSystem.ResetProgressReflector()
        form.Close()
        form.Dispose()
    End Try
End Sub

Inheritance

Object ProgressReflector

See Also

ProgressReflector Members

DevExpress.XtraPrinting Namespace