Metodo ContextNodeBase.Reparent
Aggiornamento: novembre 2007
Rimuove l'oggetto ContextNodeBase dall'elemento padre corrente e lo aggiunge a un altro elemento padre.
Spazio dei nomi: System.Windows.Ink.AnalysisCore
Assembly: IACore (in IACore.dll)
Sintassi
'Dichiarazione
Public Sub Reparent ( _
newParentNode As ContextNodeBase _
)
'Utilizzo
Dim instance As ContextNodeBase
Dim newParentNode As ContextNodeBase
instance.Reparent(newParentNode)
public void Reparent(
ContextNodeBase newParentNode
)
public:
void Reparent(
ContextNodeBase^ newParentNode
)
public void Reparent(
ContextNodeBase newParentNode
)
public function Reparent(
newParentNode : ContextNodeBase
)
Parametri
- newParentNode
Tipo: System.Windows.Ink.AnalysisCore.ContextNodeBase
Nuovo elemento padre dell'oggetto ContextNodeBase.
Esempi
In questo esempio vengono accettati tutti gli oggetti ContextNodeBase di TypeLine e vengono inseriti nei relativi oggetti ContextNodeBase di tipo Paragraph. Vengono utilizzate le righe di un oggetto InkAnalyzerBase, theInkAnalyzerBase;, viene creato un nuovo sottonodo di paragrafo per ciascuna riga, vengono riassociate le righe ai nuovi paragrafi come elementi padre e vengono eliminati i paragrafi originali.
' Take each line and make it its own paragraph
Dim originalParagraphs As ContextNodeBaseCollection = _
theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Paragraph)
Dim lines As ContextNodeBaseCollection = _
theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line)
Dim lineNode As ContextNodeBase
For Each lineNode In lines
' Create a new alignment level and paragraph
Dim lineParagraph As ContextNodeBase = lineNode.ParentNode
Dim writingRegion As ContextNodeBase = lineParagraph.ParentNode
Dim newParagraph As ContextNodeBase = _
writingRegion.CreateSubNode(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Paragraph)
' Reparent the line
lineNode.Reparent(newParagraph)
Next lineNode
' Remove original paragraphs and alignment nodes
Dim originalParagraph As ContextNodeBase
For Each originalParagraph In originalParagraphs
Dim originalAlignmentLevel As ContextNodeBase = originalParagraph.ParentNode
originalAlignmentLevel.DeleteSubNode(originalParagraph)
originalAlignmentLevel.ParentNode.DeleteSubNode(originalAlignmentLevel)
Next originalParagraph
// Take each line and make it its own paragraph
ContextNodeBaseCollection originalParagraphs =
theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Paragraph);
ContextNodeBaseCollection lines =
theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line);
foreach (ContextNodeBase lineNode in lines)
{
// Create a new paragraph
ContextNodeBase paragraph = lineNode.ParentNode;
ContextNodeBase writingRegion = paragraph.ParentNode;
ContextNodeBase newParagraph =
writingRegion.CreateSubNode(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Paragraph);
// Reparent the line
lineNode.Reparent(newParagraph);
}
// Remove original paragraphs
foreach (ContextNodeBase originalParagraph in originalParagraphs)
{
ContextNodeBase originalWritingRegion = originalParagraph.ParentNode;
originalWritingRegion.DeleteSubNode(originalParagraph);
}
Piattaforme
Windows Vista, Windows XP SP2, Windows Server 2003
.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