Condividi tramite


InkAnalyzer.FindNodesOfType Method (Guid)

Returns a ContextNodeCollection that contains all ContextNode objects of the specified type.

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

Syntax

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

returnValue = instance.FindNodesOfType(type)
public ContextNodeCollection FindNodesOfType (
    Guid type
)
public:
ContextNodeCollection^ FindNodesOfType (
    Guid type
)
public ContextNodeCollection FindNodesOfType (
    Guid type
)
public function FindNodesOfType (
    type : Guid
) : ContextNodeCollection
Not applicable.

Parameters

  • type

Return Value

A ContextNodeCollection containing all of the ContextNode objects of the specified type that are in the node tree of the InkAnalyzer.

Example

The following example shows how to loop through all the LineNode objects in an InkAnalyzer, theInkAnalyzer. In each line, it loops through all InkWordNode objects and, if there are two inkWord nodes that 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 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
System.Windows.Ink Namespace
System.Windows.Ink.InkAnalyzer.FindInkLeafNodes
InkAnalyzer.FindLeafNodes
InkAnalyzer.FindNode
System.Windows.Ink.InkAnalyzer.FindNodes