Metodo ContextNode.Reparent
Aggiornamento: novembre 2007
Rimuove l'oggetto ContextNode dal padre corrente e lo aggiunge a un altro padre.
Spazio dei nomi: Microsoft.Ink
Assembly: Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)
Sintassi
'Dichiarazione
Public Sub Reparent ( _
newParentNode As ContextNode _
)
'Utilizzo
Dim instance As ContextNode
Dim newParentNode As ContextNode
instance.Reparent(newParentNode)
public void Reparent(
ContextNode newParentNode
)
public:
void Reparent(
ContextNode^ newParentNode
)
public void Reparent(
ContextNode newParentNode
)
public function Reparent(
newParentNode : ContextNode
)
Parametri
- newParentNode
Tipo: Microsoft.Ink.ContextNode
Nuovo elemento padre di cui ContextNode diventa figlio.
Esempi
In questo esempio tutte le righe vengono inserite nei rispettivi paragrafi. Vengono utilizzate le righe di un oggetto InkAnalyzer, theInkAnalyzer;; viene creato un nuovo sottonodo di paragrafo per ciascuna di esse, vengono riassociate come padre le righe ai nuovi paragrafi ed eliminati i paragrafi originali.
' 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);
}
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