'宣言 Public ReadOnly Property UIElement As UltraTabControlUIElement
public UltraTabControlUIElement UIElement {get;}
Imports Infragistics.Win Imports Infragistics.Win.UltraWinTabs Imports Infragistics.Win.UltraWinTabControl Private Sub ultraTabControl1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ultraTabControl1.Click Dim mainElement As UIElement Dim element As UIElement Dim screenPoint As Point Dim clientPoint As Point Dim tabClickedOn As UltraTab ' Get the control's main element mainElement = Me.ultraTabControl1.UIElement ' Convert the current mouse position to a point ' in client coordinates of the control. screenPoint = Control.MousePosition clientPoint = Me.ultraTabControl1.PointToClient(screenPoint) ' Get the element at that point element = mainElement.ElementFromPoint(clientPoint) If element Is Nothing Then Return Debug.WriteLine("Clicked on an " + element.GetType().ToString()) Debug.Indent() ' Get the row that contains this element. tabClickedOn = element.GetContext(GetType(UltraTab)) If Not tabClickedOn Is Nothing Then Debug.WriteLine("in tab: " + tabClickedOn.Text) End If ' Walk up the parent element chain and write out a line ' for each parent element. While Not element.Parent Is Nothing element = element.Parent Debug.WriteLine("is a child of an " + element.GetType().ToString()) Debug.Indent() End While ' reset the indent level Debug.IndentLevel = 0 End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinTabs; using Infragistics.Win.UltraWinTabControl; private void ultraTabControl1_Click(object sender, System.EventArgs e) { UIElement mainElement; UIElement element; Point screenPoint; Point clientPoint; UltraTab tabClickedOn; // Get the control's main element mainElement = this.ultraTabControl1.UIElement; // Convert the current mouse position to a point // in client coordinates of the control. screenPoint = Control.MousePosition; clientPoint = this.ultraTabControl1.PointToClient( screenPoint ); // Get the element at that point element = mainElement.ElementFromPoint( clientPoint ); if ( element == null ) return; Debug.WriteLine( "Clicked on an " + element.GetType().ToString() ); Debug.Indent(); // Get the row that contains this element. tabClickedOn = element.GetContext( typeof( UltraTab ) ) as UltraTab; if ( tabClickedOn != null ) { Debug.WriteLine( "in tab: " + tabClickedOn.Text ); } // Walk up the parent element chain and write out a line // for each parent element. while (element.Parent != null ) { element = element.Parent; Debug.WriteLine("is a child of an " + element.GetType().ToString()); Debug.Indent(); } // reset the indent level Debug.IndentLevel = 0; }