Version

ToolFromPoint Method

Gets the ToolBase at the specified screen location.
Syntax
'Declaration
 
Public Function ToolFromPoint( _
   ByVal point As Point _
) As ToolBase
public ToolBase ToolFromPoint( 
   Point point
)

Parameters

point
The location, in screen coordinates, to test for a tool.

Return Value

The ToolBase at the specified location or null if no tool exists at the location.
Example
The following code demonstrates how to determine the Tool, Toolbar or UIElement under a mouse point.

Imports System.Diagnostics
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinToolbars

	Private Sub GetToolbarItemUnderScreenPoint(ByVal screenPoint As Point)

		' Display information about the tool under the current mouse position.
		Dim toolUnderPoint As ToolBase = Me.UltraToolbarsManager1.ToolFromPoint(screenPoint)
		If Not toolUnderPoint Is Nothing Then
			Debug.WriteLine("The key of the tool under the point '" + screenPoint.ToString() + "' is '" + toolUnderPoint.Key + "'.  The tool is of type '" + toolUnderPoint.GetType().ToString())
		End If


		' Display information about the toolbar under the current mouse position.
		Dim toolbarUnderPoint As UltraToolbar = Me.UltraToolbarsManager1.ToolbarFromPoint(screenPoint)
		If Not toolbarUnderPoint Is Nothing Then
			Debug.WriteLine("The key of the tool under the point '" + screenPoint.ToString() + "' is '" + toolbarUnderPoint.Key + "'.  It's current dock location is '" + toolbarUnderPoint.DockedPosition.ToString())
		End If


		' Display information about the UIElement under the current mouse position.
		Dim elementUnderPoint As UIElement = Me.UltraToolbarsManager1.UIElementFromPoint(screenPoint)
		If Not elementUnderPoint Is Nothing Then
			Debug.WriteLine("The key of the tool under the point '" + screenPoint.ToString() + "' is '" + elementUnderPoint.GetType().ToString())
		End If

	End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinToolbars;

		private void GetToolbarItemUnderScreenPoint(Point screenPoint)
		{

			// Display information about the tool under the current mouse position.
			ToolBase toolUnderPoint = this.ultraToolbarsManager1.ToolFromPoint(screenPoint);
			if (toolUnderPoint != null)
				Debug.WriteLine("The key of the tool under the point '" + screenPoint.ToString() + "' is '" + toolUnderPoint.Key + "'.  The tool is of type '" + toolUnderPoint.GetType().ToString());


			// Display information about the toolbar under the current mouse position.
			UltraToolbar toolbarUnderPoint = this.ultraToolbarsManager1.ToolbarFromPoint(screenPoint);
			if (toolbarUnderPoint != null)
				Debug.WriteLine("The key of the tool under the point '" + screenPoint.ToString() + "' is '" + toolbarUnderPoint.Key + "'.  It's current dock location is '" + toolbarUnderPoint.DockedPosition.ToString());


			// Display information about the UIElement under the current mouse position.
			UIElement elementUnderPoint = this.ultraToolbarsManager1.UIElementFromPoint(screenPoint);
			if (elementUnderPoint != null)
				Debug.WriteLine("The key of the tool under the point '" + screenPoint.ToString() + "' is '" + elementUnderPoint.GetType().ToString());

		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also