AccessibleObject::HitTest Method (Int32, Int32)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Retrieves the child object at the specified screen coordinates.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public:
virtual AccessibleObject^ HitTest(
	int x,
	int y
)

Parameters

x
Type: System::Int32

The horizontal screen coordinate.

y
Type: System::Int32

The vertical screen coordinate.

Return Value

Type: System.Windows.Forms::AccessibleObject^

An AccessibleObject that represents the child object at the given screen coordinates. This method returns the calling object if the object itself is at the location specified. Returns null if no object is at the tested location.

Exception Condition
COMException

The control cannot be hit tested.

For nonrectangular objects such as list view items, the coordinates of the object's bounding rectangle retrieved by Bounds can fail if tested with HitTest, because HitTest determines the object's boundaries on a pixel-by-pixel basis.

Notes to Inheritors:

All visual objects must support this method; sound objects do not support it.

.NET Framework
Available since 1.1
Return to top
Show: