MatchesCriteriaCallback 委托

表示用于评估 ContextNode 对象是否满足某个指定条件的函数。

命名空间:  System.Windows.Ink
程序集:  IAWinFX(在 IAWinFX.dll 中)

语法

声明
Public Delegate Function MatchesCriteriaCallback ( _
    visitingNode As ContextNode, _
    data As Object _
) As Boolean
用法
Dim instance As New MatchesCriteriaCallback(AddressOf HandlerMethod)
public delegate bool MatchesCriteriaCallback(
    ContextNode visitingNode,
    Object data
)
public delegate bool MatchesCriteriaCallback(
    ContextNode^ visitingNode, 
    Object^ data
)
/** @delegate */
public delegate boolean MatchesCriteriaCallback(
    ContextNode visitingNode,
    Object data
)
JScript 不支持委托。

参数

返回值

类型:System.Boolean
如果 visitingNode 与条件匹配,则为 true;否则为 false。

示例

下面的示例在名为 theInkAnalyzer 的 InkAnalyzer 中查找满足特定条件的 ContextNode 对象的集合,该条件是通过使用整数 yValue 在 MatchesCriteriaCallBack 委托函数 LineIsLowerThan 中指定的。

Dim lineIsLowerThanCallback As New MatchesCriteriaCallback(AddressOf LineIsLowerThan)
Dim nodesBelowYValue As ContextNodeCollection = theInkAnalyzer.FindNodes(lineIsLowerThanCallback, yValue)
MatchesCriteriaCallback
    lineIsLowerThanCallback = new MatchesCriteriaCallback(LineIsLowerThan);
ContextNodeCollection nodesBelowYValue =
    theInkAnalyzer.FindNodes(lineIsLowerThanCallback, yValue);

如果 ContextNodeLineNode,且边界框的底部低于传入的整数所指示的位置,则 LineIsLowerThan 返回 true。因此,nodesBelowYValue 集合包含笔画位于 yValue 值所指示的位置之下的所有行。请记住,越高的 y 值在屏幕上显示的位置越低。

Public Function LineIsLowerThan(ByVal node As ContextNode, ByVal data As Object) As Boolean 
    ' Return false if not a line
    If Not TypeOf node Is LineNode Then
        Return False
    End If 
    ' Check if bottom is lower than yValue passed in
    Dim yValue As Double = System.Convert.ToDouble(data)
    Return node.Location.GetBounds().Bottom > yValue

End Function 'LineIsLowerThan
public bool LineIsLowerThan(ContextNode node, object data)
{
    // Return false if not a line
    if (!(node is LineNode))
        return false;

    // Check if bottom is lower than yValue passed in
    double yValue = (double)data;
    return (node.Location.GetBounds().Bottom > yValue);
}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

System.Windows.Ink 命名空间

InkAnalyzer.FindNodes