Version

Print Preview with WinGanttViewPrintDocument

Topic Overview

Purpose

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.

Required background

The following table lists the topics required as a prerequisite to understanding this topic.

Topic Purpose

Introduces the features of the WinGanttViewPrintDocument component

Using Print Preview with the WinGanttView Control

Introduction

The WinPrintPreviewDialog works with any .NET PrintDocument, including the WinGanttViewPrintDocument™ that is used to print the WinGanttView™ control.

Preview

The following screenshot is a preview of the final result.

Print Preview with WinGanttViewPrintDocument 1.png

Requirements

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.

Steps

The following steps demonstrate how to setup WinGanttView, WinGanttViewPrintDocument and WinPrintPreviewDialog controls in order to print preview the GanttView control.

Assign UltraGanttView control to UltraGanttViewPrintDocument component.

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;

Assign UltraGanttViewPrintDocument to UltraPrintPreviewDialog component.

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;

Bring the print preview dialog showing the WinGanttView control.

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

Run the application and click on the Print Preview button. The print preview dialog pops up displaying the GanttView control.

Related Content

Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic introduces the features of the WinGanttViewPrintDocument™ component.

This topic provides information about the Legend feature of the WinGanttViewPrintDocument™ component.

This topic explains, with code examples, how to customize the Print Version of the WinGanttView control using the InitializeGanttView event.