'宣言 Public Overloads Function PaneFromPosition( _ ByVal pt As Point, _ ByVal ignoreFloatingWindows As Boolean _ ) As DockablePaneBase
public DockablePaneBase PaneFromPosition( Point pt, bool ignoreFloatingWindows )
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinDock Private Sub LogDockInfoFromPoint(ByVal pt As Point) ' Use the UltraDockManager's ElementFromPoint to access ' the dock manager UIElement at the specified screen coordinate Dim element As UIElement = Me.ultraDockManager1.ElementFromPoint(pt) ' Log the information to the debug window Debug.WriteLine(New String("=", 50)) Debug.WriteLine(String.Format("Dock Information From Point:", pt)) Debug.Indent() Debug.WriteLine("UIElement Info:") Debug.Indent() If element Is Nothing Then Debug.WriteLine("null") Else Me.OutputElementInfo(element) End If Debug.Unindent() ' The 'PaneFromPosition' method accepts screen coordinates ' and a boolean indicating whether to ignore the floating ' windows. ' Passing in true for the 'ignoreFloatingWindows' argument ' will only check the docked panes on the host control Dim dockedPane As DockablePaneBase = Me.ultraDockManager1.PaneFromPosition(pt, True) ' Passing in false will include the floating windows when ' checking the coordinate Dim anyPane As DockablePaneBase = Me.ultraDockManager1.PaneFromPosition(pt, False) Debug.WriteLine("Pane From Position (Ignoring Floating Windows):") Debug.Indent() If dockedPane Is Nothing Then Debug.WriteLine("null") Else Me.OutputPaneInfo(dockedPane) End If Debug.Unindent() Debug.WriteLine("Pane From Position (Including Floating Windows):") Debug.Indent() If dockedPane Is anyPane Then Debug.WriteLine("Same as ignoring floating windows") ElseIf anyPane Is Nothing Then Debug.WriteLine("null") Else ' The only time this will be is if we are over a floating ' window that is positioned over another docked pane Me.OutputPaneInfo(anyPane) End If Debug.Unindent() Debug.Unindent() Debug.WriteLine(New String("=", 50)) End Sub Private Sub OutputPaneInfo(ByVal pane As DockablePaneBase) ' The ToString method of the pane includes information ' about the pane including Debug.Write(pane.ToString()) If (pane.IsActive) Then Debug.Write(", [Active Pane]") End If If (pane.IsSelectedTab) Then Debug.Write(", [Selected Tab]") End If If (pane.MaximizedResolved) Then Debug.Write(", [Maximized]") ElseIf (pane.MinimizedResolved) Then Debug.Write(", [Minimized]") End If Debug.WriteLine(String.Empty) ' Walk up the parent change If Not pane.Parent Is Nothing Then Debug.Indent() Me.OutputPaneInfo(pane.Parent) Debug.Unindent() End If End Sub Private Sub OutputElementInfo(ByVal element As UIElement) Debug.Write(element.ToString()) ' Get the default context for the element Dim defaultContext As Object = element.GetContext(Nothing, False) If Not defaultContext Is Nothing Then Debug.Write(String.Format(", Context = '{0}'", defaultContext)) End If Debug.WriteLine(String.Empty) If Not element.Parent Is Nothing Then Debug.Indent() Me.OutputElementInfo(element.Parent) Debug.Unindent() End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinDock; using System.Diagnostics; private void LogDockInfoFromPoint( Point pt ) { // Use the UltraDockManager's ElementFromPoint to access // the dock manager UIElement at the specified screen coordinate UIElement element = this.ultraDockManager1.ElementFromPoint(pt); // Log the information to the debug window Debug.WriteLine( new string('=', 50) ); Debug.WriteLine( string.Format("Dock Information From Point:", pt)); Debug.Indent(); Debug.WriteLine("UIElement Info:"); Debug.Indent(); if (element == null) Debug.WriteLine("{null}"); else this.OutputElementInfo(element); Debug.Unindent(); // The 'PaneFromPosition' method accepts screen coordinates // and a boolean indicating whether to ignore the floating // windows. // Passing in true for the 'ignoreFloatingWindows' argument // will only check the docked panes on the host control DockablePaneBase dockedPane = this.ultraDockManager1.PaneFromPosition(pt,true); // Passing in false will include the floating windows when // checking the coordinate DockablePaneBase anyPane = this.ultraDockManager1.PaneFromPosition(pt,false); Debug.WriteLine("Pane From Position (Ignoring Floating Windows):"); Debug.Indent(); if (dockedPane == null) Debug.WriteLine("{null}"); else this.OutputPaneInfo(dockedPane); Debug.Unindent(); Debug.WriteLine("Pane From Position (Including Floating Windows):"); Debug.Indent(); if (dockedPane == anyPane) Debug.WriteLine("Same as ignoring floating windows"); else if (anyPane == null) Debug.WriteLine("{null}"); else { // The only time this will be is if we are over a floating // window that is positioned over another docked pane this.OutputPaneInfo(anyPane); } Debug.Unindent(); Debug.Unindent(); Debug.WriteLine( new string('=', 50) ); } private void OutputPaneInfo( DockablePaneBase pane ) { // The ToString method of the pane includes information // about the pane including Debug.Write( pane.ToString() ); if (pane.IsActive) Debug.Write(", [Active Pane]"); if (pane.IsSelectedTab) Debug.Write(", [Selected Tab]"); if (pane.MaximizedResolved) Debug.Write(", [Maximized]"); else if (pane.MinimizedResolved) Debug.Write(", [Minimized]"); Debug.WriteLine(string.Empty); // Walk up the parent change if (pane.Parent != null) { Debug.Indent(); this.OutputPaneInfo(pane.Parent); Debug.Unindent(); } } private void OutputElementInfo( UIElement element ) { Debug.Write( element.ToString() ); // Get the default context for the element object defaultContext = element.GetContext(null, false); if (defaultContext != null) Debug.Write(string.Format(", Context = '{0}'", defaultContext)); Debug.WriteLine(string.Empty); if (element.Parent != null) { Debug.Indent(); this.OutputElementInfo(element.Parent); Debug.Unindent(); } }