IntersectionDetail 枚举

定义

提供有关 GeometryHitTestParameters 中的几何图形与点击过的可视对象之间的交集的信息。

public enum class IntersectionDetail
public enum IntersectionDetail
type IntersectionDetail = 
Public Enum IntersectionDetail
继承
IntersectionDetail

字段

Empty 1

Geometry 命中测试参数与目标可视对象(即几何图形)不相交。

FullyContains 3

Geometry 命中测试参数完全包含在目标可视对象(即几何图形)的边界内。

FullyInside 2

目标可视对象(即几何图形)完全位于 Geometry 命中测试参数内。

Intersects 4

Geometry 命中测试参数与目标可视对象(即几何图形)相交。 这意味着两个元素重叠,但任何一个元素都不包含对方。

NotCalculated 0

不计算 IntersectionDetail 值。

示例

以下示例演示如何使用 . IntersectionDetail 的属性 GeometryHitTestResult

// Return the result of the hit test to the callback.
public HitTestResultBehavior MyHitTestResultCallback(HitTestResult result)
{
    // Retrieve the results of the hit test.
    IntersectionDetail intersectionDetail = ((GeometryHitTestResult)result).IntersectionDetail;

    switch (intersectionDetail)
    {
        case IntersectionDetail.FullyContains:

            // Add the hit test result to the list that will be processed after the enumeration.
            hitResultsList.Add(result.VisualHit);

            return HitTestResultBehavior.Continue;

        case IntersectionDetail.Intersects:

            // Set the behavior to return visuals at all z-order levels.
            return HitTestResultBehavior.Continue;

        case IntersectionDetail.FullyInside:

            // Set the behavior to return visuals at all z-order levels.
            return HitTestResultBehavior.Continue;

        default:
            return HitTestResultBehavior.Stop;
    }
}
' Return the result of the hit test to the callback.
Public Function MyHitTestResultCallback(ByVal result As HitTestResult) As HitTestResultBehavior
    ' Retrieve the results of the hit test.
    Dim intersectionDetail As IntersectionDetail = (CType(result, GeometryHitTestResult)).IntersectionDetail

    Select Case intersectionDetail
        Case IntersectionDetail.FullyContains

            ' Add the hit test result to the list that will be processed after the enumeration.
            hitResultsList.Add(result.VisualHit)

            Return HitTestResultBehavior.Continue

        Case IntersectionDetail.Intersects

            ' Set the behavior to return visuals at all z-order levels.
            Return HitTestResultBehavior.Continue

        Case IntersectionDetail.FullyInside

            ' Set the behavior to return visuals at all z-order levels.
            Return HitTestResultBehavior.Continue

        Case Else
            Return HitTestResultBehavior.Stop
    End Select
End Function

注解

下图显示了命中测试几何图形 (蓝色圆) 与 (红色方块) 之间的关系。

命中测试中使用的 IntersectionDetail 图
命中测试几何图形与命中测试期间视觉几何图形之间的交集

适用于