PointHitTestResult(Visual, Point) 构造函数

定义

初始化 PointHitTestResult 类的新实例。

public:
 PointHitTestResult(System::Windows::Media::Visual ^ visualHit, System::Windows::Point pointHit);
public PointHitTestResult (System.Windows.Media.Visual visualHit, System.Windows.Point pointHit);
new System.Windows.Media.PointHitTestResult : System.Windows.Media.Visual * System.Windows.Point -> System.Windows.Media.PointHitTestResult
Public Sub New (visualHit As Visual, pointHit As Point)

参数

visualHit
Visual

表示命中测试结果的 Visual 对象。

pointHit
Point

表示命中测试结果的 Point 对象。

示例

以下示例演示如何替代用户定义的视觉对象中的默认命中测试支持。 在这种情况下,将从重写的方法创建并返回一个新 PointHitTestResult 项。

// Override default hit test support in visual object.
protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
{
    Point pt = hitTestParameters.HitPoint;

    // Perform custom actions during the hit test processing,
    // which may include verifying that the point actually
    // falls within the rendered content of the visual.

    // Return hit on bounding rectangle of visual object.
    return new PointHitTestResult(this, pt);
}
' Override default hit test support in visual object.
Protected Overrides Overloads Function HitTestCore(ByVal hitTestParameters As PointHitTestParameters) As HitTestResult
    Dim pt As Point = hitTestParameters.HitPoint

    ' Perform custom actions during the hit test processing,
    ' which may include verifying that the point actually
    ' falls within the rendered content of the visual.

    ' Return hit on bounding rectangle of visual object.
    Return New PointHitTestResult(Me, pt)
End Function

适用于