共用方式為


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 值。

範例

下列範例示範如何使用 IntersectionDetailGeometryHitTestResult 屬性。

// 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 的圖表
點擊測試幾何與點擊測試期間視覺幾何之間的交集

適用於