Version

Customizing the Print Version of the WinGanttView Control

Topic Overview

Purpose

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

Required background

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

Topic Purpose

This topic introduces the features of the WinGanttViewPrintDocument™ component.

Customizing the Print Version of the WinGanttView Control – Conceptual Overview

Introduction

At times, you may need to modify the WinGanttView control such that it affects the print version of the control but not the on-screen control. The InitializeGanttView event of the UltraGanttViewPrintDocument is used for this purpose.

The UltraGanttViewPrintDocument component renders the control’s information to the printer by creating an instance of the UltraGanttView control. When the UltraGanttView control instance is created, it is initialized based on the GanttView property and then the InitializeGanttView event is invoked to allow any further customizations to the control. This event can be used to set a different visual state of the UltraGanttView control for printing without modifying the control’s original or on-screen visual state.

Note
NOTE
The UltraGanttView instance that is created for printing is hooked up to the same UltraCalendarInfo™ and UltraCalendarLook™ components of the on-screen UltraGanttView control. Hence any changes made to the CalendarInfo and CalendarLook properties within the InitializeGanttView event affect both the print and the on-screen UltraGanttView control. This includes properties on any individual tasks since the tasks are stored in the CalendarInfo object, and also in the ActiveTask object.

Supported customizations

The print version of the WinGanttView control can be customized in the following aspects:

  • Hiding columns that show on the screen but which you do not want to print.

  • Showing columns in the print that are not shown on the screen.

  • Changing the order of the columns

  • Changing appearances such as printing with a white background to save ink.

Customizing the Print Version of the WinGanttView Control – Code Example

Description

The following code affects the display of the printed UltraGanttView control, which is different from the on-screen control.

The sample code changes the position of the Resource Names column and modifies the cell appearance of the Resource Names column on the printed UltraGanttView control.

Preview

The following pictures demonstrate the difference between the on-screen version of the WinGanttView control (top) and its print version (bottom) as customized by the sample code.

Customizing the Print Version of the WinGanttView Control 01.png

Customizing the Print Version of the WinGanttView Control 02.png

Code

In Visual Basic:

Private Sub ultraGanttViewPrintDocument1_InitializeGanttView(sender As Object, e As Infragistics.Win.UltraWinGanttView.Printing.InitializeGanttViewEventArgs)
      ' Change the position of the ‘Resource Names’ column
      e.Control.GridSettings.ColumnSettings(TaskField.Resources).VisiblePosition = 1
' Change the cell appearance of the ‘Resource Names’ column
e.Control.GridSettings.ColumnSettings(TaskField.Resources).CellAppearance.BackColor = Color.White
End Sub

In C#:

private void ultraGanttViewPrintDocument1_InitializeGanttView(object sender, Infragistics.Win.UltraWinGanttView.Printing.InitializeGanttViewEventArgs e)
{
    // Change the position of the ‘Resource Names’ column
    e.Control.GridSettings.ColumnSettings [TaskField.Resources].VisiblePosition = 1;
 // Change the cell appearance of the ‘Resource Names’ column
    e.Control.GridSettings.ColumnSettings[TaskField.Resources].CellAppearance.BackColor = Color.White;
}

Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic introduces the features of the WinGanttViewPrintDocument™ component.

This topic explains how to use the Print Preview feature of theWinGanttViewPrintDocument™. In the particular example in this topic, the WinGanttViewPrintDocument™ is used with the WinPrintPreviewDialog™ to print preview the WinGanttView™ control.

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