UIElement.InputHitTest(Point) 方法

定义

返回指定坐标上的当前元素中的输入元素(相对于当前元素的源)。Returns the input element within the current element that is at the specified coordinates, relative to the current element's origin.

public:
 System::Windows::IInputElement ^ InputHitTest(System::Windows::Point point);
public System.Windows.IInputElement InputHitTest (System.Windows.Point point);
member this.InputHitTest : System.Windows.Point -> System.Windows.IInputElement

参数

point
Point

此元素中的偏移坐标。The offset coordinates within this element.

返回

位于指定位置的子元素。The element child that is located at the given position.

注解

作为返回类型返回 IInputElement,因为该类型是 UIElementContentElement的公共接口。IInputElement is returned as the return type, because that type is a common interface for both UIElement and ContentElement. 然后,你可以相应地强制转换返回类型,或使用由 IInputElement 接口定义的某些成员的接口实例。You can then cast the return type appropriately, or use the interface instance for certain members that are defined by the IInputElement interface.

通常不会从应用程序代码中调用此方法。This method typically is not called from your application code. 仅当打算重新实现大量低级别输入功能(如重新创建鼠标设备逻辑)时,才可以调用此方法。Calling this method is only appropriate if you intend to re-implement a substantial amount of the low level input features that are already present, such as recreating mouse device logic.

IContentHost 使用同一签名来约定 InputHitTest 方法,某些元素选择显式实现此方法。IContentHost contracts an InputHitTest method with the same signature, which some elements choose to implement explicitly.

适用于