The GetDayFromPoint method is useful for hit testing to determine which, if any, Day the cursor is positioned over.
Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports Infragistics.Win.UltraWinSchedule.WeekView Private Sub GetObjectsFromPoint(ByVal point As Point, ByVal objects As Object()) ' Declare objects of each type that we are looking for Dim appointment As Appointment Dim holiday As Holiday Dim note As Note Dim day As Infragistics.Win.UltraWinSchedule.Day Dim dayOfWeek As Infragistics.Win.UltraWinSchedule.DayOfWeek Dim week As Week ' Use the GetAppointmentFromPoint method to get the appointment ' at this point if it returns Nothing, there is no Appointment there appointment = Me.ultraWeekView.GetAppointmentFromPoint(point.X, point.Y) ' Use the GetHolidayFromPoint method to get the holiday ' at this point if it returns Nothing, there is no Holiday there holiday = Me.ultraWeekView.GetHolidayFromPoint(point.X, point.Y) ' Use the GetNoteFromPoint method to get the note ' at this point if it returns Nothing, there is no Note there note = Me.ultraWeekView.GetNoteFromPoint(point.X, point.Y) ' Use the GetDayFromPoint method to get the day ' at this point if it returns Nothing, there is no day there day = Me.ultraWeekView.GetDayFromPoint(point.X, point.Y) ' Use the GetDayOfWeekFromPoint method to get the day of the week ' at this point if it returns Nothing, there is no DayOfWeek there dayOfWeek = Me.ultraWeekView.GetDayOfWeekFromPoint(point.X, point.Y) ' Use the GetDayOfWeekFromPoint method to get the week ' at this point if it returns Nothing, there is no week there week = Me.ultraWeekView.GetWeekFromPoint(point.X, point.Y) ' Add each non-null object to a new ArrayList, which we ' will then convert to an array and assign to the 'objects' ' out parameter Dim objectsFound As ArrayList = New ArrayList() ' Add each valid object to the array list If Not appointment Is Nothing Then objectsFound.Add(appointment) If Not holiday Is Nothing Then objectsFound.Add(holiday) If Not note Is Nothing Then objectsFound.Add(note) If Not day Is Nothing Then objectsFound.Add(day) If Not dayOfWeek Is Nothing Then objectsFound.Add(dayOfWeek) If Not week Is Nothing Then objectsFound.Add(week) ' Return the entities we found as an object array objects = objectsFound.ToArray() ' Output what we found to the debugger Debug.WriteLine(objects.Length.ToString() + " UltraWinSchedule objects were found: " + vbCrLf) Dim i As Integer For i = 0 To objects.Length - 1 Debug.WriteLine(objects(i).GetType().ToString()) Next End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using Infragistics.Win.UltraWinSchedule.WeekView; using System.Diagnostics; private void GetObjectsFromPoint( Point point, out object[] objects ) { // Declare objects of each type that we are looking for Appointment appointment = null; Holiday holiday = null; Note note = null; Infragistics.Win.UltraWinSchedule.Day day = null; Infragistics.Win.UltraWinSchedule.DayOfWeek dayOfWeek = null; Infragistics.Win.UltraWinSchedule.Week week = null; // Use the GetAppointmentFromPoint method to get the appointment // at this point; if it returns null, there is no Appointment there appointment = this.ultraWeekView.GetAppointmentFromPoint( point.X, point.Y ); // Use the GetHolidayFromPoint method to get the holiday // at this point; if it returns null, there is no Holiday there holiday = this.ultraWeekView.GetHolidayFromPoint( point.X, point.Y ); // Use the GetNoteFromPoint method to get the note // at this point; if it returns null, there is no Note there note = this.ultraWeekView.GetNoteFromPoint( point.X, point.Y ); // Use the GetDayFromPoint method to get the day // at this point; if it returns null, there is no day there day = this.ultraWeekView.GetDayFromPoint( point.X, point.Y ); // Use the GetDayOfWeekFromPoint method to get the day of the week // at this point; if it returns null, there is no DayOfWeek there dayOfWeek = this.ultraWeekView.GetDayOfWeekFromPoint(point.X, point.Y ); // Use the GetDayOfWeekFromPoint method to get the week // at this point; if it returns null, there is no week there week = this.ultraWeekView.GetWeekFromPoint( point.X, point.Y ); // Add each non-null object to a new ArrayList, which we // will then convert to an array abd assign to the 'objects' // out parameter ArrayList objectsFound = new ArrayList(); if ( appointment != null ) objectsFound.Add( appointment ); if ( holiday != null ) objectsFound.Add( holiday ); if ( note != null ) objectsFound.Add( note ); if ( day != null ) objectsFound.Add( day ); if ( dayOfWeek != null ) objectsFound.Add( dayOfWeek ); if ( week != null ) objectsFound.Add( week ); // Return the entities we found as an object array objects = objectsFound.ToArray(); // Output what we found to the debugger Debug.WriteLine( objects.Length.ToString() + " UltraWinSchedule objects were found: " + "\n" ); for ( int i = 0; i < objects.Length; i ++ ) { Debug.WriteLine( objects[ i ].GetType().ToString() ); } }
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