ContextNodeBase.CreateSubNode - метод
Обновлен: Ноябрь 2007
Creates a new child ContextNodeBase object.
Пространство имен: System.Windows.Ink.AnalysisCore
Сборка: IACore (в IACore.dll)
Синтаксис
'Декларация
Public Function CreateSubNode ( _
type As Guid _
) As ContextNodeBase
'Применение
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
Параметры
- type
Тип: System.Guid
The type of context node to create. Use one of the GUIDs defined in the ContextNodeTypeBase class to specify which type to create.
Возвращаемое значение
Тип: System.Windows.Ink.AnalysisCore.ContextNodeBase
The newly created ContextNodeBase object whose parent is this ContextNodeBase.
Заметки
When existing child nodes already exist, the newly created ContextNodeBase is added as the last child in the collection of SubNodes.
Примеры
This example takes all the lines and puts them into their own paragraphs. It uses the lines from an InkAnalyzerBase, theInkAnalyzerBase; creates a new paragraph subnode for each of them; and reparents the lines to those new paragraphs.
' 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);
}
Платформы
Windows Vista, Windows XP с пакетом обновления 2 (SP2), Windows Server 2003
Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.
Сведения о версии
.NET Framework
Поддерживается в версии: 3.0