Partager via


ContextNodeTypeBase, classe

Mise à jour : November 2007

Définit des valeurs qui spécifient le type de l'objet ContextNode.

Espace de noms :  System.Windows.Ink.AnalysisCore
Assembly :  IACore (dans IACore.dll)

Syntaxe

'Déclaration
Public NotInheritable Class ContextNodeTypeBase
'Utilisation
Dim instance As ContextNodeTypeBase
public sealed class ContextNodeTypeBase
public ref class ContextNodeTypeBase sealed
public final class ContextNodeTypeBase
public final class ContextNodeTypeBase

Notes

La propriété ContextNodeBase.Type et la méthode InkAnalyzerBase.FindNodesOfType utilisent fréquemment les champs de cette classe.

Exemples

Cet exemple définit la propriété Text d'un TextBox, selectedResultsTextBox, pour afficher une chaîne appropriée pour un ContextNodeBase, selectedNode. Il utilise la propriété Type pour choisir le type de texte à afficher, selon le type du 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);

}

Hiérarchie d'héritage

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

Sécurité des threads

Tous les membres static (Shared en Visual Basic) publics de ce type sont thread-safe. Il n'est pas garanti que les membres d'instance soient thread-safe.

Plateformes

Windows Vista, Windows XP SP2, Windows Server 2003

Le .NET Framework et le .NET Compact Framework ne prennent pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.

Informations de version

.NET Framework

Pris en charge dans : 3.0

Voir aussi

Référence

Membres ContextNodeTypeBase

System.Windows.Ink.AnalysisCore, espace de noms

ContextNodeBase.Type

InkAnalyzerBase.FindNodesOfType