Version

InitializeDayView Event

Invoked when an UltraDayView control is created for the print operation.
Syntax
'Declaration
 
Public Event InitializeDayView As InitializeDayViewEventHandler
public event InitializeDayViewEventHandler InitializeDayView
Event Data

The event handler receives an argument of type InitializeDayViewEventArgs containing data related to this event. The following InitializeDayViewEventArgs properties provide information specific to this event.

PropertyDescription
Control Returns the Infragistics.Win.UltraWinSchedule.UltraDayView control that will be used for the print operation.
Remarks

The UltraSchedulePrintDocument creates instances of the various schedule controls in order to render the calendar information to the printer. When the control is created, it is initialized based on the respective 'Template' property (e.g. TemplateDayView) and then the associated initialize event (e.g. InitializeDayView) is invoked to allow any further customizations to the control.

Example
This samples demonstrates how to use the 'InitializeDayView' event to initialize properties on the UltraDayView used by the UltraSchedulePrintDocument.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' add an additional owner
        Me.UltraSchedulePrintDocument1.CalendarInfo.Owners.Add(Environment.UserName)

        ' select a week of dates
        Me.UltraSchedulePrintDocument1.CalendarInfo.SelectedDateRanges.Clear()
        Me.UltraSchedulePrintDocument1.CalendarInfo.SelectedDateRanges.Add(DateTime.Today, DateTime.Today.AddDays(7D))
    End Sub

    Private Sub UltraSchedulePrintDocument1_InitializeDayView(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.Printing.InitializeDayViewEventArgs) Handles UltraSchedulePrintDocument1.InitializeDayView
        ' properties that affect the general display
        ' are always available
        e.Control.AdditionalTimeZoneVisible = True
        Dim timeZones As ArrayList = Infragistics.Win.Utilities.GetTimeZones()
        e.Control.AdditionalTimeZoneUtcOffset = (CType(timeZones(2), TimeZoneInfo)).UtcOffset
        e.Control.AdditionalTimeZoneLabel = (CType(timeZones(2), TimeZoneInfo)).StandardName
        e.Control.CurrentTimeZoneLabel = "Local Time"

        ' while others may be overriden depending on the print style...

        ' the grouping style and preferredinview properties
        ' can be used to determine how many columns are printed
        ' per page
        e.Control.GroupingStyle = DayViewGroupingStyle.DateWithinOwner
        e.Control.PreferredInViewGroupCount = 2 ' 2 owners per page
        e.Control.PreferredInViewColumnCount = 6 ' 3 dates per owner per page
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;

		private void Form1_Load(object sender, System.EventArgs e)
		{
			// add an additional owner
			this.ultraSchedulePrintDocument1.CalendarInfo.Owners.Add(Environment.UserName);

			// select a week of dates
			this.ultraSchedulePrintDocument1.CalendarInfo.SelectedDateRanges.Clear();
			this.ultraSchedulePrintDocument1.CalendarInfo.SelectedDateRanges.Add(DateTime.Today, DateTime.Today.AddDays(7d));
		}

		private void ultraSchedulePrintDocument1_InitializeDayView(object sender, Infragistics.Win.UltraWinSchedule.Printing.InitializeDayViewEventArgs e)
		{
			// properties that affect the general display
			// are always available
			e.Control.AdditionalTimeZoneVisible = true;
			ArrayList timeZones = Infragistics.Win.Utilities.GetTimeZones();
			e.Control.AdditionalTimeZoneUtcOffset = ((TimeZoneInfo)timeZones[2]).UtcOffset;
			e.Control.AdditionalTimeZoneLabel = ((TimeZoneInfo)timeZones[2]).StandardName;
			e.Control.CurrentTimeZoneLabel = "Local Time";

			// while others may be overriden depending on the print style...
			
			// the grouping style and preferredinview properties
			// can be used to determine how many columns are printed
			// per page
			e.Control.GroupingStyle = DayViewGroupingStyle.DateWithinOwner;
			e.Control.PreferredInViewGroupCount = 2;	// 2 owners per page
			e.Control.PreferredInViewColumnCount = 6;	// 3 dates per owner per page
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also