EndTime プロパティの値は、排他的であるとみなされます。すなわち時間の範囲は実値を含まず、EndTime プロパティの実値より 1 分早ために StartTime からの時間内のすべてのポイントになります。たとえば、Start プロパティは 09:00 時間、End プロパティは 17:00 時間に設定されます。その結果、時間の範囲は 9 AM から 4:59:59 PM になります。たとえば、5 PM 自体は含まないそれ以前などです。稼働時間や範囲の外観に適用する時間範囲は、9AM から 4:59:59 PM です。ただし、5PM 自身を含まない、5 PM 以前です。これは、UltraDayView コントロールで使用された時間範囲モデルを保存します。各 TimeSlot の終了時間が、日付順で次の時間帯の 1 分前と一致します。このメソッドは TimeRangesCollection へメンバーを追加する時に、プログラムでコードを簡素化することにも利用されます。
Imports System.Collections.Generic Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports System.Diagnostics ' Add a new Owner to the Owners collection Dim myOwner As Owner = Me.calendarInfo.Owners.Add("myCalendar") ' Create an OwnerDateSettings object for the first day of the current month Dim dateSettings As OwnerDateSettings = New OwnerDateSettings(New DateTime(DateTime.Today.Year, DateTime.Today.Month, 1)) ' Designate the day as a workday dateSettings.IsWorkDay = DefaultableBoolean.True ' Add two sets of working hours, one for 9AM to 12PM, ' and another for 1PM to 5PM dateSettings.WorkingHours.Add(New TimeRange(TimeSpan.FromHours(9), TimeSpan.FromHours(12))) dateSettings.WorkingHours.Add(New TimeRange(TimeSpan.FromHours(13), TimeSpan.FromHours(17))) ' Create an appearance to indicate that the office is closed Dim officeClosedAppearance As Appearance = New Appearance() officeClosedAppearance.BackColor = Color.White officeClosedAppearance.BackColor2 = Color.LightGray officeClosedAppearance.BackGradientStyle = GradientStyle.Horizontal officeClosedAppearance.BorderColor = Color.Transparent ' Create TimeRanges for the hours during which the office is closed, ' which is 12AM to 6AM, and 8PM to 12AM Dim closed1 As TimeRange = New TimeRange(TimeSpan.FromHours(0), TimeSpan.FromHours(6)) Dim closed2 As TimeRange = New TimeRange(TimeSpan.FromHours(20), TimeSpan.FromHours(24)) ' Add two TimeRangeAppearance objects, one for each range during which ' the office is closed dateSettings.TimeRangeAppearances.Add(closed1, officeClosedAppearance) dateSettings.TimeRangeAppearances.Add(closed2, officeClosedAppearance) ' Add the OwnerDateSettings object to the Owner's DateSettings collection myOwner.DateSettings.Add(dateSettings)
using System.Collections.Generic; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using System.Diagnostics; // Add a new Owner to the Owners collection Owner myOwner = this.calendarInfo.Owners.Add( "myCalendar" ); // Create an OwnerDateSettings object for the first day of the current month OwnerDateSettings dateSettings = new OwnerDateSettings( new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1) ); // Designate the day as a workday dateSettings.IsWorkDay = DefaultableBoolean.True; // Add two sets of working hours, one for 9AM to 12PM, // and another for 1PM to 5PM dateSettings.WorkingHours.Add( new TimeRange( TimeSpan.FromHours(9), TimeSpan.FromHours(12) ) ); dateSettings.WorkingHours.Add( new TimeRange( TimeSpan.FromHours(13), TimeSpan.FromHours(17) ) ); // Create an appearance to indicate that the office is closed Appearance officeClosedAppearance = new Appearance(); officeClosedAppearance.BackColor = Color.White; officeClosedAppearance.BackColor2 = Color.LightGray; officeClosedAppearance.BackGradientStyle = GradientStyle.Horizontal; officeClosedAppearance.BorderColor = Color.Transparent; // Create TimeRanges for the hours during which the office is closed, // which is 12AM to 6AM, and 8PM to 12AM TimeRange closed1 = new TimeRange( TimeSpan.FromHours(0), TimeSpan.FromHours(6) ); TimeRange closed2 = new TimeRange( TimeSpan.FromHours(20), TimeSpan.FromHours(24) ); // Add two TimeRangeAppearance objects, one for each range during which // the office is closed dateSettings.TimeRangeAppearances.Add( closed1, officeClosedAppearance ); dateSettings.TimeRangeAppearances.Add( closed2, officeClosedAppearance ); // Add the OwnerDateSettings object to the Owner's DateSettings collection myOwner.DateSettings.Add( dateSettings );