Sdílet prostřednictvím


InkAnalyzer.FindNodesOfType Method (Guid, ContextNode)

Returns a ContextNodeCollection that contains ContextNode objects of a specified type that are also descendants of the specified ContextNode.

Namespace:  System.Windows.Ink
Assembly:  IAWinFX (in IAWinFX.dll)

Syntax

'Declaration
Public Function FindNodesOfType ( _
    type As Guid, _
    node As ContextNode _
) As ContextNodeCollection
'Usage
Dim instance As InkAnalyzer 
Dim type As Guid 
Dim node As ContextNode 
Dim returnValue As ContextNodeCollection 

returnValue = instance.FindNodesOfType(type, _
    node)
public ContextNodeCollection FindNodesOfType(
    Guid type,
    ContextNode node
)
public:
ContextNodeCollection^ FindNodesOfType(
    Guid type, 
    ContextNode^ node
)
public function FindNodesOfType(
    type : Guid, 
    node : ContextNode
) : ContextNodeCollection

Parameters

Return Value

Type: System.Windows.Ink.ContextNodeCollection
ContextNode objects of a specified type that are also descendants of the specified ContextNode.

Examples

The following example shows how to loop through all the LineNode objects in an InkAnalyzer named theInkAnalyzer. In each line, it loops through all InkWordNode objects and, if two consecutive InkWordNode objects are recognized as the same word, it marks them as red.

' If two identical ink words occur next to each other, mark them as red. 
' Note: This doesn't actually look for pairs that go across two lines. 
Dim lines As ContextNodeCollection = theInkAnalyzer.FindNodesOfType(ContextNodeType.Line)
Dim lineNode As ContextNode
For Each lineNode In  lines
    Dim previousWord As InkWordNode = Nothing 

    For Each inkWord As InkWordNode In _
        theInkAnalyzer.FindNodesOfType(ContextNodeType.InkWord, lineNode)

        If Not (previousWord Is Nothing) AndAlso _
            previousWord.GetRecognizedString() = inkWord.GetRecognizedString() Then 

            For Each stroke As Stroke In previousWord.Strokes
                stroke.DrawingAttributes.Color = Colors.Red
            Next stroke

            For Each stroke As Stroke In inkWord.Strokes
                stroke.DrawingAttributes.Color = Colors.Red
            Next stroke
        End If

        previousWord = inkWord
    Next inkWord
Next lineNode
// If two identical ink words occur next to each other, mark them as red. 
// Note: This doesn't actually look for pairs that go across two lines.
ContextNodeCollection lines =
    theInkAnalyzer.FindNodesOfType(ContextNodeType.Line);
foreach (ContextNode lineNode in lines)
{
    InkWordNode previousWord = null;
    foreach (InkWordNode inkWord in
             theInkAnalyzer.FindNodesOfType(ContextNodeType.InkWord, lineNode))
    {
        if (previousWord != null &&
            previousWord.GetRecognizedString() == inkWord.GetRecognizedString())
        {
            foreach (Stroke stroke in previousWord.Strokes)
                stroke.DrawingAttributes.Color = Colors.Red;
            foreach (Stroke stroke in inkWord.Strokes)
                stroke.DrawingAttributes.Color = Colors.Red;
        }
        previousWord = inkWord;
    }
}

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkAnalyzer Class

InkAnalyzer Members

FindNodesOfType Overload

System.Windows.Ink Namespace

InkAnalyzer.FindInkLeafNodes

InkAnalyzer.FindLeafNodes

InkAnalyzer.FindNode

InkAnalyzer.FindNodes