一部のパネル スタイルでは、パネルで表示される情報は、他の値に基づいて計算または変更されます。DisplayText は、すべてのフォーマッティングを考慮して、パネルによって現在表示されるテキストを返します。
Imports Infragistics.Win Imports Infragistics.Win.UltraWinStatusBar Imports System.Diagnostics Private Sub ultraStatusBar1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ultraStatusBar1.Click Dim mainElement As UIElement Dim element As UIElement Dim screenPoint As Point Dim clientPoint As Point Dim panel As UltraStatusPanel ' Get the control's main element mainElement = Me.ultraStatusBar1.UIElement ' Convert the current mouse position to a point ' in client coordinates of the control. screenPoint = Control.MousePosition clientPoint = Me.ultraStatusBar1.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. panel = element.GetContext(GetType(UltraStatusPanel)) If Not panel Is Nothing Then Debug.WriteLine("panel style: " + panel.Style.ToString()) Debug.WriteLine("key: " + panel.Key) Debug.WriteLine("index: " + panel.Index.ToString()) Debug.WriteLine("text: " + panel.DisplayText) 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.UltraWinStatusBar; private void ultraStatusBar1_Click(object sender, System.EventArgs e) { UIElement mainElement; UIElement element; Point screenPoint; Point clientPoint; UltraStatusPanel panel; // Get the control's main element mainElement = this.ultraStatusBar1.UIElement; // Convert the current mouse position to a point // in client coordinates of the control. screenPoint = Control.MousePosition; clientPoint = this.ultraStatusBar1.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. panel = element.GetContext( typeof( UltraStatusPanel ) ) as UltraStatusPanel; if ( panel != null ) { Debug.WriteLine( "panel style: " + panel.Style.ToString() ); Debug.WriteLine( "key: " + panel.Key ); Debug.WriteLine( "index: " + panel.Index.ToString() ); Debug.WriteLine( "text: " + panel.DisplayText ); } // 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; }