Partager via


ContextNodeBase.Type, propriété

Mise à jour : November 2007

Obtient le type de nœud de contexte de cet objet ContextNodeBase.

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

Syntaxe

'Déclaration
Public ReadOnly Property Type As Guid
'Utilisation
Dim instance As ContextNodeBase
Dim value As Guid

value = instance.Type
public Guid Type { get; }
public:
property Guid Type {
    Guid get ();
}
/** @property */
public Guid get_Type()
public function get Type () : Guid

Valeur de propriété

Type : System.Guid

Exemples

L'exemple suivant montre comment utiliser la propriété Type d'un objet ContextNodeBase nommé selectedNode. Le texte d'un TextBox, selectedResultsTextBox, est rempli différemment selon le type de nœud. Dans la plupart des cas, la chaîne reconnue est utilisée, mais pour InkWord, la chaîne reconnue de la ligne est utilisée, et le mot est sélectionné dans le TextBox.

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);

}

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

ContextNodeBase, classe

Membres ContextNodeBase

System.Windows.Ink.AnalysisCore, espace de noms

System.Windows.Ink.AnalysisCore.ContextNodeTypeBase

InkAnalyzerBase.FindNodesOfType

InkAnalyzerBase.FindNodesOfType

InkAnalyzerBase.FindNodesOfType