Freigeben über


ContextNodeBase.SubNodes-Eigenschaft

Ruft die direkten untergeordneten Elemente des ContextNodeBase-Objekts ab.

Namespace:  System.Windows.Ink.AnalysisCore
Assembly:  IACore (in IACore.dll)

Syntax

'Declaration
Public ReadOnly Property SubNodes As ContextNodeBaseCollection
'Usage
Dim instance As ContextNodeBase
Dim value As ContextNodeBaseCollection

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

Eigenschaftenwert

Typ: System.Windows.Ink.AnalysisCore.ContextNodeBaseCollection
Die direkten untergeordneten Elemente des ContextNodeBase-Objekts.

Hinweise

Hierdurch werden nur die direkt untergeordneten Elemente und nicht alle Nachfolger zurückgegeben.

Beispiele

Dieses Beispiel zeigt eine Methode, die rekursiv eine Struktur von ContextNodeBase-Objekten durchläuft. Es verwendet die SubNodes-Eigenschaft und füllt eine System.Windows.Forms.TreeView durch Hinzufügen von TreeNode-Objekten auf. Es legt dann ihre Text-Eigenschaft auf ToString fest und fügt ggf. die erkannte Zeichenfolge oder den Formnamen hinzu.

Private Sub WalkTree(ByVal parentContextNode As ContextNodeBase, ByVal parentTreeNode As TreeNode)

    Dim cNode As ContextNodeBase

    For Each cNode In parentContextNode.SubNodes

        Dim newTNode As New TreeNode(cNode.ToString())

        If cNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkWord AndAlso _
           cNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString) Then

            newTNode.Text = newTNode.Text + _
                ": " + CType(cNode.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString), _
                String)

        ElseIf cNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkDrawing AndAlso _
               cNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.ShapeName) Then

            Dim shapeName As String = CType(cNode.GetPropertyData(PropertyGuidsForContextNodesBase.ShapeName), _
                String)

            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(
    System.Windows.Ink.AnalysisCore.ContextNodeBase parentContextNode, TreeNode parentTreeNode)
{
    foreach (ContextNodeBase cNode in parentContextNode.SubNodes)
    {
        TreeNode newTNode = new TreeNode(cNode.ToString());
        if ((cNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkWord) &&
             cNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString))
        {
            // Get the recognized string
            newTNode.Text += ": " +
                (string)cNode.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString);
        }
        else if ((cNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkDrawing) &&
                  cNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.ShapeName))
        {
            newTNode.Text += ": " +
                (string)cNode.GetPropertyData(PropertyGuidsForContextNodesBase.ShapeName);
        }
        WalkTree(cNode, newTNode);
        parentTreeNode.Nodes.Add(newTNode);

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

Plattformen

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework und .NET Compact Framework unterstützen nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.

Versionsinformationen

.NET Framework

Unterstützt in: 3.0

Siehe auch

Referenz

ContextNodeBase-Klasse

ContextNodeBase-Member

System.Windows.Ink.AnalysisCore-Namespace

ContextNodeBase.SubNodes

ContextNodeBase.ParentNode