HitTestResultBehavior 枚举

定义

确定在命中测试期间是否继续任何剩余可见对象的枚举。

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

字段

Continue 1

继续对可视化树层次结构中的下一个可见对象进行命中测试。

Stop 0

停止任何进一步的命中测试,并从该回调返回。

示例

以下示例演示如何从命中测试结果回调方法返回值 HitTestResultBehavior

// Return the result of the hit test to the callback.
public HitTestResultBehavior MyHitTestResult(HitTestResult result)
{
    // Add the hit test result to the list that will be processed after the enumeration.
    hitResultsList.Add(result.VisualHit);

    // Set the behavior to return visuals at all z-order levels.
    return HitTestResultBehavior.Continue;
}
' Return the result of the hit test to the callback.
Public Function MyHitTestResult(ByVal result As HitTestResult) As HitTestResultBehavior
    ' Add the hit test result to the list that will be processed after the enumeration.
    hitResultsList.Add(result.VisualHit)

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

注解

命中测试结果回调方法定义在可视化树中特定视觉对象上标识命中测试时执行的操作。 执行操作后,将返回一个 HitTestResultBehavior 值,该值确定是否继续枚举任何其他视觉对象。

可以在可视化树中枚举其几何包含特定坐标值的所有视觉对象。 通过在命中测试回调方法中返回 Continue ,可以识别被命中的所有视觉对象,甚至可能部分或完全遮盖其他视觉对象的对象。

适用于

另请参阅