Condividi tramite


Classe ContextNodeCollection

Aggiornamento: novembre 2007

Contiene un insieme di oggetti ContextNode che sono il risultato di un'analisi dell'input penna.

Spazio dei nomi:  Microsoft.Ink
Assembly:  Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)

Sintassi

'Dichiarazione
Public Class ContextNodeCollection _
    Implements ICollection, IEnumerable
'Utilizzo
Dim instance As ContextNodeCollection
public class ContextNodeCollection : ICollection, 
    IEnumerable
public ref class ContextNodeCollection : ICollection, 
    IEnumerable
public class ContextNodeCollection implements ICollection, 
    IEnumerable
public class ContextNodeCollection implements ICollection, IEnumerable

Esempi

Nell'esempio seguente viene illustrato come eseguire il ciclo in un oggetto ContextNodeCollection dal metodo InkAnalyzer. FindNodesOfType(ContextNodeType, ContextNode) di un oggetto InkAnalyzer, theInkAnalyzer. In questo esempio viene eseguito il ciclo in tutti i nodi di riga e, se sono presenti due nodi di parola di input penna con la stessa parola, questi vengono contrassegnati in rosso.

' 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(Microsoft.Ink.ContextNodeType.Line)
Dim lineNode As ContextNode
Dim stroke As Stroke

For Each lineNode In lines

    Dim previousWord As InkWordNode = Nothing
    Dim inkWord As InkWordNode
    For Each inkWord In _
        theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.InkWord, lineNode)

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

            For Each stroke In previousWord.Strokes
                stroke.DrawingAttributes = New DrawingAttributes(Color.Red)
            Next stroke
            For Each stroke In inkWord.Strokes
                stroke.DrawingAttributes = New DrawingAttributes(Color.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(Microsoft.Ink.ContextNodeType.Line);
            foreach (ContextNode lineNode in lines)
            {
                InkWordNode previousWord = null;
                foreach (InkWordNode inkWord in 
                         theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.InkWord, lineNode))
                {
                    if (previousWord != null &&
                        previousWord.GetRecognizedString() == inkWord.GetRecognizedString())
                    {
                        foreach (Stroke stroke in previousWord.Strokes)
                            stroke.DrawingAttributes = new DrawingAttributes(Color.Red);
                        foreach (Stroke stroke in inkWord.Strokes)
                            stroke.DrawingAttributes = new DrawingAttributes(Color.Red);
                    }
                    previousWord = inkWord;
                }
            }

Gerarchia di ereditarietà

System.Object
  Microsoft.Ink.ContextNodeCollection

Codice thread safe

Qualsiasi membro static (Shared in Visual Basic) pubblico di questo tipo è thread-safe. I membri di istanza non sono garantiti come thread-safe.

Piattaforme

Windows Vista

.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.

Informazioni sulla versione

.NET Framework

Supportato in: 3.0

Vedere anche

Riferimenti

Membri ContextNodeCollection

Spazio dei nomi Microsoft.Ink

ContextNode

FindNodes(MatchesCriteriaCallBack, Object, ContextNode)

InkAnalyzer.FindNodesOfType