Поделиться через


IntersectionDetail Перечисление

Определение

Предоставляет сведения о пересечении между геометриями в GeometryHitTestParameters и визуальным элементом, который был достигнут.

public enum class IntersectionDetail
public enum IntersectionDetail
type IntersectionDetail = 
Public Enum IntersectionDetail
Наследование
IntersectionDetail

Поля

Имя Значение Описание
NotCalculated 0

Значение IntersectionDetail не вычисляется.

Empty 1

Параметр Geometry теста попадания и целевой визуальный элемент или геометрия не пересекаются.

FullyInside 2

Целевой визуальный элемент или геометрия полностью находится в параметре теста попадания Geometry .

FullyContains 3

Параметр Geometry теста попадания полностью содержится в пределах границ целевого визуального элемента или геометрии.

Intersects 4

Параметр Geometry теста попадания и целевой визуальный элемент, или геометрия, пересекаются. Это означает, что два элемента перекрываются, но ни один элемент не содержит другого.

Примеры

В следующем примере показано, как использовать 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

Комментарии

На следующем рисунке показана связь между геометрией теста попадания (синим кругом) и визуальной геометрией (красным квадратом).

Схема пересеченияDetail, используемая при тестировании диаграммы пересеченияDetail, используемой Пересечение между геометрией теста попадания и визуальной геометрией во время тестирования попаданий

Применяется к