'宣言 Public Overloads Function GetVisibleDayFromPoint( _ ByVal x As Integer, _ ByVal y As Integer _ ) As VisibleDay
public VisibleDay GetVisibleDayFromPoint( int x, int y )
Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Private Sub UltraDayView1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles UltraDayView1.MouseMove ' Create a point from the X and Y coordinates passed in the MouseEventArgs Dim point As Point = New Point(e.X, e.Y) ' ----------------------------------------------------------------------- ' Get the Appointment under the point and display a message in the output window if we find one. Dim appointment As Appointment = Me.UltraDayView1.GetAppointmentFromPoint(e.X, e.Y) ' NOTE: Could also call GetAppointmentFromPoint passing in a point. ' appointment = Me.ultraDayView1.GetAppointmentFromPoint(point) If Not appointment Is Nothing Then Debug.WriteLine("Appointment '" + appointment.Subject + "' is under the mouse point (" + point.ToString() + ")") End If ' ----------------------------------------------------------------------- ' Get the TimeSlot under the point and display a message in the output window if we find one. Dim timeSlot As TimeSlot = Me.UltraDayView1.GetTimeSlotFromPoint(e.X, e.Y) ' NOTE: Could also call GetTimeSlotFromPoint passing in a point. ' timeSlot = Me.ultraDayView1.GetTimeSlotFromPoint(point) If Not timeSlot Is Nothing Then Debug.WriteLine("The TimeSlot starting at " + timeSlot.StartTime.ToLongTimeString() + " and ending at " + timeSlot.EndTime.ToLongTimeString() + " is under the mouse point (" + point.ToString() + ")") End If ' ----------------------------------------------------------------------- ' Get the VisibleDay under the point and display a message in the output window if we find one. Dim visibleDay As VisibleDay = Me.UltraDayView1.GetVisibleDayFromPoint(e.X, e.Y) ' NOTE: Could also call GetVisibleDayFromPoint passing in a point. ' visibleDay = Me.ultraDayView1.GetVisibleDayFromPoint(point) If Not visibleDay Is Nothing Then Debug.WriteLine("The VisibleDay for " + visibleDay.Date.ToLongDateString() + " is under the mouse point (" + point.ToString() + ")") End If End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; private void ultraDayView1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { // Create a point from the X and Y coordinates passed in the MouseEventArgs Point point = new Point(e.X, e.Y); // ----------------------------------------------------------------------- // Get the Appointment under the point and display a message in the output window if we find one. Appointment appointment = this.ultraDayView1.GetAppointmentFromPoint(e.X, e.Y); // NOTE: Could also call GetAppointmentFromPoint passing in a point. // appointment = this.ultraDayView1.GetAppointmentFromPoint(point); if (appointment != null) Debug.WriteLine("Appointment '" + appointment.Subject + "' is under the mouse point (" + point.ToString() + ")"); // ----------------------------------------------------------------------- // Get the TimeSlot under the point and display a message in the output window if we find one. TimeSlot timeSlot = this.ultraDayView1.GetTimeSlotFromPoint(e.X, e.Y); // NOTE: Could also call GetTimeSlotFromPoint passing in a point. // timeSlot = this.ultraDayView1.GetTimeSlotFromPoint(point); if (timeSlot != null) Debug.WriteLine("The TimeSlot starting at " + timeSlot.StartTime.ToLongTimeString() + " and ending at " + timeSlot.EndTime.ToLongTimeString() + " is under the mouse point (" + point.ToString() + ")"); // ----------------------------------------------------------------------- // Get the VisibleDay under the point and display a message in the output window if we find one. VisibleDay visibleDay = this.ultraDayView1.GetVisibleDayFromPoint(e.X, e.Y); // NOTE: Could also call GetVisibleDayFromPoint passing in a point. // visibleDay = this.ultraDayView1.GetVisibleDayFromPoint(point); if (visibleDay != null) Debug.WriteLine("The VisibleDay for " + visibleDay.Date.ToLongDateString() + " is under the mouse point (" + point.ToString() + ")"); }