GeometryHitTestResult.IntersectionDetail 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得點擊測試的 IntersectionDetail 值。
public:
property System::Windows::Media::IntersectionDetail IntersectionDetail { System::Windows::Media::IntersectionDetail get(); };
public System.Windows.Media.IntersectionDetail IntersectionDetail { get; }
member this.IntersectionDetail : System.Windows.Media.IntersectionDetail
Public ReadOnly Property IntersectionDetail As IntersectionDetail
屬性值
點擊測試的 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 描述 與 Geometry 目標視覺物件之間的交集。
下圖顯示點擊測試幾何 (藍色圓圈) 與目標物件 (紅色方塊) 之間的關聯性。
點擊測試幾何與目標物件之間的交集