Source code of the tutorial is available for download.
C#
private void LoadTimelineHours() { DayPilotScheduler1.Scale = TimeScale.Manual; DayPilotScheduler1.Timeline.Clear(); for (int i = 0; i < DayPilotScheduler1.Days; i++) { DateTime day = DayPilotScheduler1.StartDate.AddDays(i); for (int x = MorningShiftStarts; x < MorningShiftEnds; x++) { DayPilotScheduler1.Timeline.Add(day.AddHours(x), day.AddHours(x + 1)); } for (int x = AfternoonShiftStarts; x < AfternoonShiftEnds; x++) { DayPilotScheduler1.Timeline.Add(day.AddHours(x), day.AddHours(x + 1)); } } DayPilotScheduler1.TimeHeaders.Clear(); DayPilotScheduler1.TimeHeaders.Add(new TimeHeader(GroupByEnum.Month)); DayPilotScheduler1.TimeHeaders.Add(new TimeHeader(GroupByEnum.Day, "ddd d")); DayPilotScheduler1.TimeHeaders.Add(new TimeHeader(GroupByEnum.Hour, "ht")); }
VB
Private Sub LoadTimelineHours() DayPilotScheduler1.Scale = TimeScale.Manual DayPilotScheduler1.Timeline.Clear() For i As Integer = 0 To DayPilotScheduler1.Days - 1 Dim day As Date = DayPilotScheduler1.StartDate.AddDays(i) For x As Integer = MorningShiftStarts To MorningShiftEnds - 1 DayPilotScheduler1.Timeline.Add(day.AddHours(x), day.AddHours(x + 1)) Next x For x As Integer = AfternoonShiftStarts To AfternoonShiftEnds - 1 DayPilotScheduler1.Timeline.Add(day.AddHours(x), day.AddHours(x + 1)) Next x Next i DayPilotScheduler1.TimeHeaders.Clear() DayPilotScheduler1.TimeHeaders.Add(New TimeHeader(GroupByEnum.Month)) DayPilotScheduler1.TimeHeaders.Add(New TimeHeader(GroupByEnum.Day, "ddd d")) DayPilotScheduler1.TimeHeaders.Add(New TimeHeader(GroupByEnum.Hour, "ht")) End Sub