IntersectionDetail 列舉

定義

提供 GeometryHitTestParameters 中之幾何與所點擊視覺物件之間的交集資訊。

C#
public enum IntersectionDetail
繼承
IntersectionDetail

欄位

Empty 1

Geometry 點擊測試參數和目標視覺物件 (或幾何) 沒有交集。

FullyContains 3

Geometry 點擊測試參數完全包含在目標視覺物件 (或幾何) 的界限內。

FullyInside 2

目標視覺物件 (或幾何) 完全位在 Geometry 點擊測試參數內。

Intersects 4

Geometry 點擊測試參數與目標視覺物件 (或幾何) 有所交集。 這表示兩個項目重疊,但是沒有一個項目完全包含在另一個項目內。

NotCalculated 0

不計算 IntersectionDetail 值。

範例

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

C#
// 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;
    }
}

備註

下圖顯示點擊測試幾何 (藍色圓圈) 與視覺化幾何 (紅色方塊) 之間的關聯性。

在點擊測試中所使用 IntersectionDetail 的圖表
點擊測試幾何與點擊測試期間視覺幾何之間的交集

適用於

產品 版本
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7