'宣言 Public Shared Function FromTimeSlot( _ ByVal timeSlot As TimeSlot, _ ByVal adjustEndTime As Boolean _ ) As TimeRange
public static TimeRange FromTimeSlot( TimeSlot timeSlot, bool adjustEndTime )
TimeSlot オブジェクトの終了時刻は、次の TimeSlot 開始時刻より 1 分早い値を返します。これは、隣接する TimeSlots 間で重なることを防止します。adjustEndTime は、WorkingHours または TimeRangeAppearancesで使用できる TimeRange インスタンスを簡単に作成する方法を提供します。
Imports System.Collections.Generic Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports System.Diagnostics AddHandler Me.dayView.MouseDown, AddressOf dayView_MouseDown Private Sub dayView_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Dim dayView As UltraDayView = sender Dim ownerAtPoint = dayView.OwnerFromPoint(e.Location) Dim timeSlot As TimeSlot = Nothing Dim dateAtPoint As Nullable(Of DateTime) = dayView.DateTimeFromPoint(e.Location, timeSlot) If Not ownerAtPoint Is Nothing AndAlso dateAtPoint.HasValue Then Dim timeRange As TimeRange = Nothing If Not timeSlot Is Nothing Then timeRange = Infragistics.Win.UltraWinSchedule.TimeRange.FromTimeSlot(timeSlot, False) Dim timeRangeString As String = String.Empty If Not timeRange Is Nothing Then timeRangeString = String.Format(", TimeSlot = {0}", timeRange.ToString(True)) Console.WriteLine(String.Format("Owner = '{0}', Date = {1}{2}", ownerAtPoint.Key, dateAtPoint.Value.ToShortDateString(), timeRangeString)) End If End Sub
using System.Collections.Generic; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using System.Diagnostics; this.dayView.MouseDown += new MouseEventHandler(dayView_MouseDown); void dayView_MouseDown(object sender, MouseEventArgs e) { UltraDayView dayView = sender as UltraDayView; Owner ownerAtPoint = dayView.OwnerFromPoint( e.Location ); TimeSlot timeSlot = null; Nullable<DateTime> dateAtPoint = dayView.DateTimeFromPoint( e.Location, out timeSlot ); if ( ownerAtPoint != null && dateAtPoint.HasValue ) { TimeRange timeRange = timeSlot != null ? TimeRange.FromTimeSlot( timeSlot, false ) : null; string timeRangeString = timeSlot != null ? string.Format(", TimeSlot = {0}", timeRange.ToString(true)) : string.Empty; Console.WriteLine( string.Format( "Owner = '{0}', Date = {1}{2}", ownerAtPoint.Key, dateAtPoint.Value.ToShortDateString(), timeRangeString) ); } }