'宣言 Public ReadOnly Property SelectedTimeSlotRange As SelectedTimeSlotRange
public SelectedTimeSlotRange SelectedTimeSlotRange {get;}
このプロパティを使用して、現在選択されているタイムスロットを決定します。
Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click ' If the month, day and year of both the range start and range end dates are 1/1/1 ' then no range has been selected by the user. In this case, display a message and ' exit. Dim startOfRange As DateTime = Me.UltraDayView1.SelectedTimeSlotRange.StartDateTime Dim endOfRange As DateTime = Me.UltraDayView1.SelectedTimeSlotRange.EndDateTime If (startOfRange.Month = 1 And startOfRange.Day = 1 And startOfRange.Year = 1 And _ endOfRange.Month = 1 And endOfRange.Day = 1 And endOfRange.Year = 1) Then Debug.WriteLine("There is no currently selected time slot range!") Return End If ' Display the currently selected time slot range in the output window. Dim startOfRangeAsString As String = Me.UltraDayView1.SelectedTimeSlotRange.StartDateTime.ToString("M/d/yyyy hh:mm tt") Dim endOfRangeAsString As String = Me.UltraDayView1.SelectedTimeSlotRange.EndDateTime.ToString("M/d/yyyy hh:mm tt") Debug.WriteLine("The current SelectedTimeSlotRange is: [Start: " + startOfRangeAsString + "] [End: " + endOfRangeAsString + "]") ' Change the selected time slot range by adding 1 hour to the start time and ' 2 hours to the end time. Display the updated range in the output window. Dim newStartOfRange As DateTime = startOfRange.AddHours(1) Dim newEndOfRange As DateTime = endOfRange.AddHours(2) Me.UltraDayView1.SelectedTimeSlotRange.SetRange(newStartOfRange, newEndOfRange) Debug.WriteLine(" The new SelectedTimeSlotRange is: [Start: " + newStartOfRange.ToString("M/d/yyyy hh:mm tt") + "] [End: " + newEndOfRange.ToString("M/d/yyyy hh:mm tt") + "]") End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; private void button15_Click(object sender, System.EventArgs e) { // If the month, day and year of both the range start and range end dates are 1/1/1 // then no range has been selected by the user. In this case, display a message and // exit. DateTime startOfRange = this.ultraDayView1.SelectedTimeSlotRange.StartDateTime; DateTime endOfRange = this.ultraDayView1.SelectedTimeSlotRange.EndDateTime; if (startOfRange.Month == 1 && startOfRange.Day == 1 && startOfRange.Year == 1 && endOfRange.Month == 1 && endOfRange.Day == 1 && endOfRange.Year == 1) { Debug.WriteLine("There is no currently selected time slot range!"); return; } // Display the currently selected time slot range in the output window. string startOfRangeAsString = this.ultraDayView1.SelectedTimeSlotRange.StartDateTime.ToString("M/d/yyyy hh:mm tt"); string endOfRangeAsString = this.ultraDayView1.SelectedTimeSlotRange.EndDateTime.ToString("M/d/yyyy hh:mm tt"); Debug.WriteLine("The current SelectedTimeSlotRange is: [Start: " + startOfRangeAsString + "] [End: " + endOfRangeAsString + "]"); // Change the selected time slot range by adding 1 hour to the start time and // 2 hours to the end time. Display the updated range in the output window. DateTime newStartOfRange = startOfRange.AddHours((double)1); DateTime newEndOfRange = endOfRange.AddHours((double)2); this.ultraDayView1.SelectedTimeSlotRange.SetRange(newStartOfRange, newEndOfRange); Debug.WriteLine(" The new SelectedTimeSlotRange is: [Start: " + newStartOfRange.ToString("M/d/yyyy hh:mm tt") + "] [End: " + newEndOfRange.ToString("M/d/yyyy hh:mm tt") + "]"); }