Condividi tramite


Proprietà ContextNode.SubNodes

Aggiornamento: novembre 2007

Ottiene l'elemento figlio diretto dell'oggetto ContextNode.

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

Sintassi

'Dichiarazione
Public ReadOnly Property SubNodes As ContextNodeCollection
'Utilizzo
Dim instance As ContextNode
Dim value As ContextNodeCollection

value = instance.SubNodes
public ContextNodeCollection SubNodes { get; }
public:
property ContextNodeCollection^ SubNodes {
    ContextNodeCollection^ get ();
}
/** @property */
public ContextNodeCollection get_SubNodes()
public function get SubNodes () : ContextNodeCollection

Valore proprietà

Tipo: Microsoft.Ink.ContextNodeCollection
Elemento figlio diretto dell'oggetto ContextNode.

Note

Restituisce solo l'elemento figlio diretto, non tutti i discendenti.

Esempi

In questo esempio viene utilizzato un metodo che attraversa in modo ricorsivo una struttura ad albero di oggetti ContextNode. Viene utilizza la proprietà SubNodes e viene compilato un oggetto System.Windows.Forms.TreeView aggiungendo oggetti TreeNode. Vengono quindi impostate le proprietà Text su GetRecognizedString.

Private Sub WalkTree(ByVal parentContextNode As Microsoft.Ink.ContextNode, _
                     ByVal parentTreeNode As TreeNode)

    Dim cNode As ContextNode
    For Each cNode In parentContextNode.SubNodes
        Dim newTNode As New TreeNode(cNode.ToString())
        If TypeOf cNode Is Microsoft.Ink.InkWordNode Then
            newTNode.Text = newTNode.Text + _
                ": " + CType(cNode, InkWordNode).GetRecognizedString()
        ElseIf TypeOf cNode Is Microsoft.Ink.InkDrawingNode Then
            Dim shapeName As String = CType(cNode, InkDrawingNode).GetShapeName()
            If shapeName <> "" Then
                newTNode.Text = newTNode.Text + ": " + shapeName
            End If
        End If
        WalkTree(cNode, newTNode)
        parentTreeNode.Nodes.Add(newTNode)

        ' Add the context node as a tag of the tree node
        newTNode.Tag = cNode
    Next cNode

End Sub 'WalkTree
        private void WalkTree(ContextNode parentContextNode, TreeNode parentTreeNode)
        {
            foreach (ContextNode cNode in parentContextNode.SubNodes)
            {
                TreeNode newTNode = new TreeNode(cNode.ToString());
                if (cNode is Microsoft.Ink.InkWordNode)
                {
                    newTNode.Text +=
                        ": " + ((InkWordNode)cNode).GetRecognizedString();
                }
                else if (cNode is Microsoft.Ink.InkDrawingNode)
                {
                    String shapeName = ((InkDrawingNode)cNode).GetShapeName();
                    if (shapeName != "")
                        newTNode.Text += ": " + shapeName;
                }
                WalkTree(cNode, newTNode);
                parentTreeNode.Nodes.Add(newTNode);

                // Add the context node as a tag of the tree node
                newTNode.Tag = cNode;
            }
        }

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

ContextNode Classe

Membri ContextNode

Spazio dei nomi Microsoft.Ink

ContextNode.ParentNode