Compartir a través de


ContextNode.DeleteSubNode (Método)

Actualización: noviembre 2007

Se elimina un objeto ContextNode secundario.

Espacio de nombres:  Microsoft.Ink
Ensamblado:  Microsoft.Ink.Analysis (en Microsoft.Ink.Analysis.dll)

Sintaxis

'Declaración
Public Sub DeleteSubNode ( _
    subNodeToDelete As ContextNode _
)
'Uso
Dim instance As ContextNode
Dim subNodeToDelete As ContextNode

instance.DeleteSubNode(subNodeToDelete)
public void DeleteSubNode(
    ContextNode subNodeToDelete
)
public:
void DeleteSubNode(
    ContextNode^ subNodeToDelete
)
public void DeleteSubNode(
    ContextNode subNodeToDelete
)
public function DeleteSubNode(
    subNodeToDelete : ContextNode
)

Parámetros

Comentarios

Se produce una excepción ArgumentException si subNodeToDelete no es un elemento secundario de este objeto ContextNode.

Ejemplos

En este ejemplo todas las líneas se sitúan en sus propios párrafos. Se utilizan las líneas de un objeto InkAnalyzer, theInkAnalyzer; se crea un nuevo subnodo de párrafo para cada uno de ellos; se cambia el elemento primario de las líneas para esos nuevos párrafos y se eliminan los párrafos originales.

' Take each line and make it its own paragraph
Dim originalParagraphs As ContextNodeCollection = _
    theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.Paragraph)
Dim lines As ContextNodeCollection = _
    theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.Line)
Dim lineNode As ContextNode
For Each lineNode In lines
    ' Create a new alignment level and paragraph
    Dim lineParagraph As ContextNode = lineNode.ParentNode
    Dim writingRegion As ContextNode = lineParagraph.ParentNode
    Dim newParagraph As ParagraphNode = _
        CType(writingRegion.CreateSubNode(Microsoft.Ink.ContextNodeType.Paragraph), ParagraphNode)
    ' Reparent the line
    lineNode.Reparent(newParagraph)
Next lineNode
' Remove original paragraphs and alignment nodes
Dim originalParagraph As ContextNode
For Each originalParagraph In originalParagraphs
    Dim originalAlignmentLevel As ContextNode = originalParagraph.ParentNode
    originalAlignmentLevel.DeleteSubNode(originalParagraph)
    originalAlignmentLevel.ParentNode.DeleteSubNode(originalAlignmentLevel)
Next originalParagraph
            // Take each line and make it its own paragraph
            ContextNodeCollection originalParagraphs = 
                theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.Paragraph);
            ContextNodeCollection lines = 
                theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.Line);
            foreach (ContextNode lineNode in lines)
            {
                // Create a new paragraph
                ContextNode paragraph = lineNode.ParentNode;
                ContextNode writingRegion = paragraph.ParentNode;
                ParagraphNode newParagraph = (ParagraphNode)
                    writingRegion.CreateSubNode(Microsoft.Ink.ContextNodeType.Paragraph);
                // Reparent the line
                lineNode.Reparent(newParagraph);
            }
            // Remove original paragraphs 
            foreach (ContextNode originalParagraph in originalParagraphs)
            {
                ContextNode originalWritingRegion = originalParagraph.ParentNode;
                originalWritingRegion.DeleteSubNode(originalParagraph);
            }

Plataformas

Windows Vista

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Información de versión

.NET Framework

Compatible con: 3.0

Vea también

Referencia

ContextNode (Clase)

ContextNode (Miembros)

Microsoft.Ink (Espacio de nombres)

ContextNode.CreateSubNode