バージョン

DateTimeFromPoint メソッド (ControlWithActivityBase)

指定されたポイントに DateTime を返します。ヒット テストは日時を生成しなかった場合 Null を返します。
シンタックス
'宣言
 
Public Overridable Function DateTimeFromPoint( _
   ByVal point As Point _
) As Nullable(Of Date)
public virtual Nullable<DateTime> DateTimeFromPoint( 
   Point point
)

パラメータ

point
テストする位置で、クライアント座標で表されます。
使用例
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) );
        }
    }
参照