AccessibleObject.HitTest(Int32, Int32) AccessibleObject.HitTest(Int32, Int32) AccessibleObject.HitTest(Int32, Int32) AccessibleObject.HitTest(Int32, Int32) Method

定义

检索位于指定屏幕坐标的子对象。Retrieves the child object at the specified screen coordinates.

public:
 virtual System::Windows::Forms::AccessibleObject ^ HitTest(int x, int y);
public virtual System.Windows.Forms.AccessibleObject HitTest (int x, int y);
abstract member HitTest : int * int -> System.Windows.Forms.AccessibleObject
override this.HitTest : int * int -> System.Windows.Forms.AccessibleObject
Public Overridable Function HitTest (x As Integer, y As Integer) As AccessibleObject

参数

x
Int32 Int32 Int32 Int32

水平屏幕坐标。The horizontal screen coordinate.

y
Int32 Int32 Int32 Int32

垂直屏幕坐标。The vertical screen coordinate.

返回

一个 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. 如果测试位置没有对象,则返回 nullReturns null if no object is at the tested location.

异常

无法对控件进行点击检测。The control cannot be hit tested.

注解

对于不包含列表视图项的非矩形对象,如果使用进行了Bounds HitTest测试,则检索到的对象的边框的坐标HitTest可能会失败,因为在每个像素的基础上确定对象的边界。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.

继承者说明

所有视觉对象都必须支持此方法;声音对象不支持此操作。All visual objects must support this method; sound objects do not support it.

适用于