UIElement.InputHitTest(Point) 方法


在目前項目範圍中傳回的輸入項目,輸入項目位在相對於目前項目原點的指定座標。Returns the input element within the current element that is at the specified coordinates, relative to the current element's origin.

 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



這個項目內的位移 (Offset) 座標。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.