Freigeben über


InkAnalyzer.FindNodes Method (MatchesCriteriaCallback, Object, ContextNode)

Returns the ContextNode objects that are descendants of the specified ContextNode and that match the specified criteria.

Namespace: Microsoft.Ink
Assembly: Microsoft.Ink.Analysis (in microsoft.ink.analysis.dll)

Syntax

'Declaration
Public Function FindNodes ( _
    criteria As MatchesCriteriaCallback, _
    data As Object, _
    nodeToSearch As ContextNode _
) As ContextNodeCollection
'Usage
Dim instance As InkAnalyzer
Dim criteria As MatchesCriteriaCallback
Dim data As Object
Dim nodeToSearch As ContextNode
Dim returnValue As ContextNodeCollection

returnValue = instance.FindNodes(criteria, data, nodeToSearch)
public ContextNodeCollection FindNodes (
    MatchesCriteriaCallback criteria,
    Object data,
    ContextNode nodeToSearch
)
public:
ContextNodeCollection^ FindNodes (
    MatchesCriteriaCallback^ criteria, 
    Object^ data, 
    ContextNode^ nodeToSearch
)
public ContextNodeCollection FindNodes (
    MatchesCriteriaCallback criteria, 
    Object data, 
    ContextNode nodeToSearch
)
public function FindNodes (
    criteria : MatchesCriteriaCallback, 
    data : Object, 
    nodeToSearch : ContextNode
) : ContextNodeCollection
Not applicable.

Parameters

  • criteria
    A delegate function that determines if a ContextNode meets or fails its specified criteria.
  • data
    Optional extra data that may be passed into the delegate function. This method passes this data to the delegate with each call and does not modify or examine it.
  • nodeToSearch
    The ContextNode whose descendants are searched.

Return Value

A ContextNodeCollection containing all of the ContextNode objects that are descendants of the specified node and that match the specified criteria.

Example

The following example finds the collection of ContextNode objects in an InkAnalyzer, theInkAnalyzer, that satisfy the criteria specified in the LineIsLowerThan delegate. The 32-bit signed integer, yValue, is passed to the LineIsLowerThan delegate. The search is confined to the descendants of the WritingRegionNode, 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);

The following example defines the LineIsLowerThan method, which returns true if the ContextNode is a LineNode and if the bottom of the bounding box is lower than an integer that is passed in. (Note that higher y-coordinate values mean lower on the screen.) Therefore, the nodesBelowYValue collection contains all lines with strokes below the value, yValue.

Public Function LineIsLowerThan(ByVal node As Microsoft.Ink.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 Integer = Fix(data)
    Return node.Location.GetBounds().Bottom > yValue

End Function 'LineIsLowerThan
public bool LineIsLowerThan(Microsoft.Ink.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
    int yValue = (int)data;
    return (node.Location.GetBounds().Bottom > yValue);
}

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkAnalyzer Class
InkAnalyzer Members
Microsoft.Ink Namespace
Microsoft.Ink.InkAnalyzer.FindInkLeafNodes
InkAnalyzer.FindLeafNodes
InkAnalyzer.FindNode
Microsoft.Ink.InkAnalyzer.FindNodes
Microsoft.Ink.InkAnalyzer.FindNodesOfType