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
}
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