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 DevExpress.XtraEditors.ProgressBarControl showing the document generation status. When the document creation is complete, the Progress Bar is hidden and the form shows a print preview.
C# |
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraPrinting;
using DevExpress.XtraPrinting.Native;
private void Form1_Load(object sender, EventArgs e) {
report = new XtraReport1();
documentViewer1.DocumentSource = report;
Form form = new Form() {
FormBorderStyle = FormBorderStyle.None,
Size = new System.Drawing.Size(300, 25),
ShowInTaskbar = false,
StartPosition = FormStartPosition.CenterScreen,
TopMost = true
};
ProgressBarControl progressBar = new ProgressBarControl();
ReflectorBar reflectorBar = new ReflectorBar(progressBar);
form.Controls.Add(progressBar);
progressBar.Dock = DockStyle.Fill;
form.Show();
try {
report.PrintingSystem.ProgressReflector = reflectorBar;
report.CreateDocument();
}
finally {
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)
report = New XtraReport1()
documentViewer1.DocumentSource = report
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
Dim progressBar As New ProgressBarControl()
Dim reflectorBar As New ReflectorBar(progressBar)
form.Controls.Add(progressBar)
progressBar.Dock = DockStyle.Fill
form.Show()
Try
report.PrintingSystem.ProgressReflector = reflectorBar
report.CreateDocument()
Finally
report.PrintingSystem.ResetProgressReflector()
form.Close()
form.Dispose()
End Try
End Sub
|