注: コントロールの OwnerDisplayStyle プロパティが 「Merged」 に設定されている場合、このメソッドは適用されず、null (VB では Nothing) を返します。
Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Private Sub ultraWeekView1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ultraWeekView1.MouseDown ' Use the GetOwnerFromPoint method to get the owner that was clicked, if any Dim ownerAtPoint As Infragistics.Win.UltraWinSchedule.Owner = Me.ultraWeekView1.GetOwnerFromPoint(e.X, e.Y) ' Use the GetOwnersInView method to get an array of the owners that are ' currently being displayed by the control Dim ownersInView() As Infragistics.Win.UltraWinSchedule.Owner = Me.ultraWeekView1.GetOwnersInView() ' Get the number of owners currently being displayed by the control Dim inViewOwnerCount As Int32 = ownersInView.GetLength(0) Dim msg As String = String.Empty ' Append the noame of the owner that was clicked to the message string If Not ownerAtPoint Is Nothing Then msg += ownerAtPoint.Name + " was clicked." + Environment.NewLine End If ' Append the name of each owner to the message string msg += "There are currently " + inViewOwnerCount.ToString() + " owners in view:" msg += Environment.NewLine Dim i As Int32 For i = 0 To ownersInView.GetLength(0) - 1 msg += ownersInView(i).Name + Environment.NewLine Next ' DIsplay the information in a message box MessageBox.Show(msg) End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using System.Diagnostics; private void ultraWeekView1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { // Use the GetOwnerFromPoint method to get the owner that was clicked, if any Infragistics.Win.UltraWinSchedule.Owner ownerAtPoint = this.ultraWeekView1.GetOwnerFromPoint( e.X, e.Y ); // Use the GetOwnersInView method to get an array of the owners that are // currently being displayed by the control Infragistics.Win.UltraWinSchedule.Owner[] ownersInView = this.ultraWeekView1.GetOwnersInView(); // Get the number of owners currently being displayed by the control int inViewOwnerCount = ownersInView.GetLength(0); string msg = string.Empty; // Append the noame of the owner that was clicked to the message string if ( ownerAtPoint != null ) msg += ownerAtPoint.Name + " was clicked." + Environment.NewLine; // Append the name of each owner to the message string msg += "There are currently " + inViewOwnerCount.ToString() + " owners in view:"; msg += Environment.NewLine; for ( int i = 0; i < ownersInView.GetLength(0); i ++ ) { msg += ownersInView[i].Name + Environment.NewLine; } // DIsplay the information in a message box MessageBox.Show( msg ); }