Returns the
Owner at the specified point, or null if the hit test did not yield an Owner.
The following code sample demonstrates how to use the OwnerFromPoint and DateTimeFromPoint methods to hit test for an Owner, date, and TimeSlot in the UltraDayView control:
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
'Declaration
Public Function OwnerFromPoint( _
ByVal As Point _
) As Owner
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) );
}
}
'Declaration
Public Function OwnerFromPoint( _
ByVal As Point _
) As Owner
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2