Rendering a Report in the Thread
Наши примеры проектов и шаблоны отчётов помогут Вам разобраться в основах работы с нашими продуктами.This example shows how to render a report in the thread. Rendering the report in the thread is run in the background process. For this purpose the
In the start of the
In the
На скриншоте ниже Вы можете увидеть результат выполнения данного кода:

BackgroundWorker class is used:
private System.ComponentModel.BackgroundWorker backgroundWorker1;
private void button1_Click(object sender, EventArgs e)
{
backgroundWorker1.RunWorkerAsync();
}
In the start of the
backgroundWorker1_DoWork() process event, you can dload the report and connect data. Also you should subscribe to the Rendering() event of the compiled report object:
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
using (var stream = Assembly.GetExecutingAssembly().
GetManifestResourceStream("RenderInThread.Master-Detail-Subdetail.mrt"))
{
report.Load(stream);
}
report.IsRendered = false;
report.Compile();
report.CompiledReport.Rendering += new EventHandler(CompiledReport_Rendering);
report.Render(false);
}
In the
CompiledReport_Rendering() event update the text on the form - show a value of the StatusString property. After completion of the thread work, show the report in the viewer:
void CompiledReport_Rendering(object sender, EventArgs e)
{
button1.Invoke((EventHandler)delegate { button1.Text = report.StatusString; });
}
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
report.Show();
}На скриншоте ниже Вы можете увидеть результат выполнения данного кода:
