InkAnalyzerBase.FindNodes 方法 (MatchesCriteriaBaseCallback, Object, ContextNodeBase)

返回作为指定 ContextNode 的后代且符合指定条件的 ContextNode 对象。

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

语法

声明
Public Function FindNodes ( _
    criteria As MatchesCriteriaBaseCallback, _
    data As Object, _
    nodeToSearch As ContextNodeBase _
) As ContextNodeBaseCollection
用法
Dim instance As InkAnalyzerBase
Dim criteria As MatchesCriteriaBaseCallback
Dim data As Object
Dim nodeToSearch As ContextNodeBase
Dim returnValue As ContextNodeBaseCollection

returnValue = instance.FindNodes(criteria, _
    data, nodeToSearch)
public ContextNodeBaseCollection FindNodes(
    MatchesCriteriaBaseCallback criteria,
    Object data,
    ContextNodeBase nodeToSearch
)
public:
ContextNodeBaseCollection^ FindNodes(
    MatchesCriteriaBaseCallback^ criteria, 
    Object^ data, 
    ContextNodeBase^ nodeToSearch
)
public ContextNodeBaseCollection FindNodes(
    MatchesCriteriaBaseCallback criteria,
    Object data,
    ContextNodeBase nodeToSearch
)
public function FindNodes(
    criteria : MatchesCriteriaBaseCallback, 
    data : Object, 
    nodeToSearch : ContextNodeBase
) : ContextNodeBaseCollection

参数

  • data
    类型:System.Object
    可传入该委托函数的可选的其他数据。此方法在每次调用中将这些数据传递给该委托,并不修改或检查这些数据。

返回值

类型:System.Windows.Ink.AnalysisCore.ContextNodeBaseCollection
包含符合指定条件的所有 ContextNodeBase 对象的 ContextNodeBaseCollection

示例

下面的示例在 InkAnalyzerBase (theInkAnalyzer) 中查找符合 LineIsLowerThan 委托中所指定的条件的 ContextNodeBase 对象的集合。一个 32 位有符号整数 yValue 将传递给 LineIsLowerThan 委托。搜索范围限制为 ContextNodeBase (writingRegion) 的后代。

Dim isLineLowerThanCallback As _
    New Microsoft.Ink.MatchesCriteriaCallback(AddressOf LineIsLowerThan)
Dim nodesInRegionBelowYValue As ContextNodeCollection = _
    theInkAnalyzer.FindNodes(isLineLowerThanCallback, yValue, writingRegion)
            Microsoft.Ink.MatchesCriteriaCallback
                isLineLowerThanCallback = new Microsoft.Ink.MatchesCriteriaCallback(LineIsLowerThan);
            ContextNodeCollection nodesInRegionBelowYValue =
                theInkAnalyzer.FindNodes(isLineLowerThanCallback, yValue, writingRegion);

下面的示例定义 LineIsLowerThan 方法,如果 ContextNodeBase 的类型为 Line 且边界框的底部低于传入的整数所指示的位置,则该方法返回 true。请注意,y 值越大,在屏幕上的位置越低。)因此,nodesBelowYValue 集合包含笔画位于 yValue 值所指示的位置之下的所有行。

Public Function LineIsLowerThan( _
    ByVal nodeBase As System.Windows.Ink.AnalysisCore.ContextNodeBase, _
    ByVal data As Object) As Boolean

    ' Return false if not a line
    If nodeBase.Type <> System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line Then
        Return False
    End If
    ' Check if bottom is lower than yValue passed in
    Dim yValue As Integer = Fix(data)
    Return nodeBase.Location.GetBounds()(3) > yValue

End Function 'LineIsLowerThan
public bool LineIsLowerThan(System.Windows.Ink.AnalysisCore.ContextNodeBase nodeBase, object data)
{
    // Return false if not a line
    if (!(nodeBase.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line))
        return false;

    // Check if bottom is lower than yValue passed in
    int yValue = (int)data;
    return (nodeBase.Location.GetBounds()[3] > yValue);

}

平台

Windows Vista, Windows XP SP2, Windows Server 2003

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

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

InkAnalyzerBase 类

InkAnalyzerBase 成员

FindNodes 重载

System.Windows.Ink.AnalysisCore 命名空间