This topic explains how to print preview the WinGanttViewPrintDocument™. In the particular example in this topic, the WinGanttViewPrintDocument™ is used with the WinPrintPreviewDialog™ to print preview the WinGanttView™ control.
The following table lists the topics required as a prerequisite to understanding this topic.
This topic contains the following sections:
The WinPrintPreviewDialog works with any .NET PrintDocument, including the WinGanttViewPrintDocument™ that is used to print the WinGanttView™ control.
The following screenshot is a preview of the final result.
To complete the procedure, you need:
UltraPrintPreviewDailog, UltraGanttViewPrintDocument, UltraCalendarInfo and UltraGanttView controls dropped onto your form.
An UltraButton™ control dropped onto the form with its Text property set to ‘Print Preview’
.
The UltraGanttView control bound to data in order to display tasks and task information. For more information, refer to the DataBinding Support for WinGanttView topic.
The following steps demonstrate how to setup WinGanttView, WinGanttViewPrintDocument and WinPrintPreviewDialog controls in order to print preview the GanttView control.
The UltraGanttViewPrintDocument component exposes a GanttView property to which the UltraGanttView control on the form must be assigned.
In Visual Basic:
Me.ultraGanttViewPrintDocument1.GanttView = Me.ultraGanttView1
In C#:
this.ultraGanttViewPrintDocument1.GanttView = this.ultraGanttView1;
The UltraGanttViewPrintDocument component must be assigned to the Document property of UltraPrintPreviewDialog.
In Visual Basic:
Me.ultraPrintPreviewDialog1.Document = Me.ultraGanttViewPrintDocument1
In C#:
this.ultraPrintPreviewDialog1.Document = this.ultraGanttViewPrintDocument1;
Write this code within the Print Preview button click event.
In Visual Basic:
Me.ultraPrintPreviewDialog1.ShowDialog(Me)
In C#:
this.ultraPrintPreviewDialog1.ShowDialog(this);
Run the application and click on the Print Preview button. The print preview dialog pops up displaying the GanttView control.
The following topics provide additional information related to this topic.