Condividi tramite


Classe ContextNodeBaseCollection

Aggiornamento: novembre 2007

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

Spazio dei nomi:  System.Windows.Ink.AnalysisCore
Assembly:  IACore (in IACore.dll)

Sintassi

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

Esempi

Nell'esempio seguente viene illustrato come riprodurre a ciclo continuo un oggetto ContextNodeBaseCollection dall'oggetto InkAnalyzerBase. Viene utilizzato il metodo FindNodesOfType di un oggetto InkAnalyzerBase denominato theInkAnalyzerBase. In questo esempio viene illustrato come riprodurre a ciclo continuo tutti i nodi di riga. Se esistono 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 ContextNodeBaseCollection = _
    theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line)

For Each lineNode As ContextNodeBase In lines

    Dim previousWord As ContextNodeBase = Nothing
    Dim previousWordRecognizedString As String = ""

    For Each inkWord As ContextNodeBase In _
        theInkAnalyzerBase.FindNodesOfType(ContextNodeTypeBase.InkWord, lineNode)

        Dim inkWordRecognizedString As String = ""

        If inkWord.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString) Then
            inkWordRecognizedString = _
                CType(inkWord.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString), String)
        End If

        ' TODO: I think I can get rid of this and just assign the previous string 
        ' to the current string
        If Not previousWord Is Nothing Then

            previousWordRecognizedString = _
            CType(previousWord.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString), String)

        End If

        If previousWordRecognizedString <> "" Then

            Dim previousWordStrokes As Strokes = theInk.CreateStrokes(previousWord.GetStrokeIds())
            Dim inkWordStrokes As Strokes = theInk.CreateStrokes(previousWord.GetStrokeIds())

            For Each aStroke As Stroke In previousWordStrokes
                aStroke.DrawingAttributes = New DrawingAttributes(Color.Red)
            Next aStroke

            For Each aStroke As Stroke In inkWordStrokes
                aStroke.DrawingAttributes = New DrawingAttributes(Color.Red)
            Next aStroke
        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.
ContextNodeBaseCollection lines =
    theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line);
foreach (ContextNodeBase lineNode in lines)
{
    ContextNodeBase previousWord = null;
    string previousWordRecognizedString = "";
    foreach (ContextNodeBase inkWord in 
        theInkAnalyzerBase.FindNodesOfType(ContextNodeTypeBase.InkWord, lineNode))
    {
        string inkWordRecognizedString = "";

        if (inkWord.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString))
        {
            inkWordRecognizedString =
                (string)inkWord.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString);
        }

        // TODO: I think I can get rid of this and just assign the previous string 
        // to the current string
        if (previousWord != null &&
            previousWord.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString))
        {
            previousWordRecognizedString =
                (string)previousWord.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString);
        }

        if (previousWordRecognizedString != "" &&
            previousWordRecognizedString == inkWordRecognizedString)
        {
            Strokes previousWordStrokes = theInk.CreateStrokes(previousWord.GetStrokeIds());
            Strokes inkWordStrokes = theInk.CreateStrokes(previousWord.GetStrokeIds());

            foreach (Stroke stroke in previousWordStrokes)
                stroke.DrawingAttributes = new DrawingAttributes(Color.Red);

            foreach (Stroke stroke in inkWordStrokes)
                stroke.DrawingAttributes = new DrawingAttributes(Color.Red);
        }
        previousWord = inkWord;
    }
}

Gerarchia di ereditarietà

System.Object
  System.Windows.Ink.AnalysisCore.ContextNodeBaseCollection

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, Windows XP SP2, Windows Server 2003

.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 ContextNodeBaseCollection

Spazio dei nomi System.Windows.Ink.AnalysisCore