Condividi tramite


Classe ContextNodeTypeBase

Aggiornamento: novembre 2007

Definisce i valori che specificano il tipo di oggetto ContextNode.

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

Sintassi

'Dichiarazione
Public NotInheritable Class ContextNodeTypeBase
'Utilizzo
Dim instance As ContextNodeTypeBase
public sealed class ContextNodeTypeBase
public ref class ContextNodeTypeBase sealed
public final class ContextNodeTypeBase
public final class ContextNodeTypeBase

Note

La proprietà ContextNodeBase.Type e il metodo InkAnalyzerBase.FindNodesOfType utilizzano spesso i campi di questa classe.

Esempi

In questo esempio viene impostata la proprietà Text di un oggetto TextBox, selectedResultsTextBox, per visualizzare una stringa appropriata per un oggetto ContextNodeBase, selectedNode. Viene utilizzata la proprietà Type per scegliere il tipo di testo da visualizzare, in base al tipo dell'oggetto ContextNodeBase.

If (selectedNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString) AndAlso _
   (selectedNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.WritingRegion OrElse _
    selectedNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Paragraph OrElse _
    selectedNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.CustomRecognizer OrElse _
    selectedNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Object OrElse _
    selectedNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line)) Then

    selectedResultsTextBox.Text = _
        CType(selectedNode.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString), String)

ElseIf (selectedNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkWord) Then
    Dim parentNode As ContextNodeBase = selectedNode.ParentNode
    If (parentNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line AndAlso _
            parentNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString)) Then

        ' Put parent line's recognized string into the text box
        selectedResultsTextBox.Text = _
            CType(parentNode.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString), String)

        ' Select the text that corresponds to the ink word
        Dim subNodes As New ContextNodeBaseCollection(theInkAnalyzerBase)
        subNodes.Add(selectedNode)
        Dim start As Integer
        Dim length As Integer
        theInkAnalyzerBase.GetTextRangeFromNodes(subNodes, start, length)
        If (start >= 0 AndAlso length > 0) Then
            selectedResultsTextBox.Select(start, length)
        End If
    End If
ElseIf (selectedNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkDrawing AndAlso _
        selectedNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.ShapeName)) Then

    selectedResultsTextBox.Text = _
        CType(selectedNode.GetPropertyData(PropertyGuidsForContextNodesBase.ShapeName), String)

End If
if (selectedNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString) &&
   (selectedNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.WritingRegion ||
    selectedNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Paragraph ||
    selectedNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.CustomRecognizer ||
    selectedNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Object ||
    selectedNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line))
{
    selectedResultsTextBox.Text =
        (string)selectedNode.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString);
}
else if (selectedNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkWord)
{
    ContextNodeBase parentNode = selectedNode.ParentNode;
    if (parentNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line &&
        parentNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString))
    {
        // Put parent line's recognized string into the text box
        selectedResultsTextBox.Text =
            (string)parentNode.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString);

        // Select the text that corresponds to the ink word
        ContextNodeBaseCollection subNodes = new ContextNodeBaseCollection(theInkAnalyzerBase);
        subNodes.Add(selectedNode);
        int start;
        int length;
        theInkAnalyzerBase.GetTextRangeFromNodes(subNodes, out start, out length);
        if (start >= 0 && length > 0)
        {
            selectedResultsTextBox.Select(start, length);
        }
    }
}
else if (selectedNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkDrawing &&
         selectedNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.ShapeName))
{
    selectedResultsTextBox.Text =
        (string)selectedNode.GetPropertyData(PropertyGuidsForContextNodesBase.ShapeName);

}

Gerarchia di ereditarietà

System.Object
  System.Windows.Ink.AnalysisCore.ContextNodeTypeBase

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 ContextNodeTypeBase

Spazio dei nomi System.Windows.Ink.AnalysisCore

ContextNodeBase.Type

InkAnalyzerBase.FindNodesOfType