ContextNodeBase.CreateSubNode, méthode
Mise à jour : November 2007
Crée un objet ContextNodeBase enfant.
Espace de noms : System.Windows.Ink.AnalysisCore
Assembly : IACore (dans IACore.dll)
Syntaxe
'Déclaration
Public Function CreateSubNode ( _
type As Guid _
) As ContextNodeBase
'Utilisation
Dim instance As ContextNodeBase
Dim type As Guid
Dim returnValue As ContextNodeBase
returnValue = instance.CreateSubNode(type)
public ContextNodeBase CreateSubNode(
Guid type
)
public:
ContextNodeBase^ CreateSubNode(
Guid type
)
public ContextNodeBase CreateSubNode(
Guid type
)
public function CreateSubNode(
type : Guid
) : ContextNodeBase
Paramètres
- type
Type : System.Guid
Type de nœud de contexte à créer. Utilisez l'un des GUID définis dans la classe ContextNodeTypeBase pour spécifier le type à créer.
Valeur de retour
Type : System.Windows.Ink.AnalysisCore.ContextNodeBase
Nouvel objet ContextNodeBase dont le parent est ce ContextNodeBase.
Notes
Lorsque des nœuds enfants existent déjà, le nouveau ContextNodeBase est ajouté en tant que dernier enfant dans la collection de SubNodes.
Exemples
Cet exemple place toutes les lignes dans leurs paragraphes respectifs. Il utilise les lignes d'un InkAnalyzerBase, theInkAnalyzerBase;, crée un sous-nœud de paragraphe pour chacun d'eux et assigne les lignes à ces nouveaux paragraphes.
' 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);
}
Plateformes
Windows Vista, Windows XP SP2, Windows Server 2003
Le .NET Framework et le .NET Compact Framework ne prennent pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.
Informations de version
.NET Framework
Pris en charge dans : 3.0