ContextNodeBase.CreateSubNode 方法
创建一个新的子 ContextNodeBase 对象。
命名空间: 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
要创建的上下文节点的类型。使用 ContextNodeTypeBase 类中定义的某个 GUID 指定要创建的类型。
返回值
类型:System.Windows.Ink.AnalysisCore.ContextNodeBase
为此 ContextNodeBase 新创建的子 ContextNodeBase 对象。
备注
如果存在现有子节点,新创建的 ContextNodeBase 将添加为 SubNodes 集合中的最后一个子级。
示例
此示例获取所有行,并将这些行放入各自的段落中。它使用 InkAnalyzerBase (theInkAnalyzerBase) 中的行,为每一行新建一个段落子节点,然后将这些行的父级重新设置为这些新段落。
' 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 SP2, Windows Server 2003
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0