次の方法で共有


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 オブジェクト。

解説

既存の子ノードが既に存在する場合、新しく作成された ContextNodeBaseSubNodes のコレクション内の最後の子として追加されます。

この例では、すべての行を独自の段落に配置します。また、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

参照

参照

ContextNodeBase クラス

ContextNodeBase メンバ

System.Windows.Ink.AnalysisCore 名前空間

ContextNodeBase.DeleteSubNode

System.Windows.Ink.AnalysisCore.ContextNodeTypeBase