Επεξεργασία

Κοινή χρήση μέσω


PointHitTestResult(Visual, Point) Constructor

Definition

Initializes a new instance of the PointHitTestResult class.

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)

Parameters

visualHit
Visual

The Visual object that represents the hit test result.

pointHit
Point

The Point object that represents the hit test result.

Examples

The following example shows how to override default hit test support in a user-defined visual object. In this case, a new PointHitTestResult is created and returned from the overridden method.

// 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

Applies to