次の方法で共有


ContextNode.ReparentStrokes メソッド

この ContextNode オブジェクトから、指定した ContextNode オブジェクトにストロークを移動します。

名前空間 :  System.Windows.Ink
アセンブリ :  IAWinFX (IAWinFX.dll 内)

構文

'宣言
Public Sub ReparentStrokes ( _
    strokes As StrokeCollection, _
    destinationNode As ContextNode _
)
'使用
Dim instance As ContextNode
Dim strokes As StrokeCollection
Dim destinationNode As ContextNode

instance.ReparentStrokes(strokes, destinationNode)
public void ReparentStrokes(
    StrokeCollection strokes,
    ContextNode destinationNode
)
public:
void ReparentStrokes(
    StrokeCollection^ strokes, 
    ContextNode^ destinationNode
)
public void ReparentStrokes(
    StrokeCollection strokes,
    ContextNode destinationNode
)
public function ReparentStrokes(
    strokes : StrokeCollection, 
    destinationNode : ContextNode
)

パラメータ

解説

指定する ContextNode は、InkWordNodeInkDrawingNodeInkBulletNode、または UnclassifiedInkNode クラスのいずれかにする必要があります。他の型の ContextNode にストロークを移動しようとすると、ArgumentException が発生します。

このメソッドは、インク以外のリーフ ContextNode オブジェクトを含む、ContextNode オブジェクトから呼び出すことができます。指定されたストロークは、この ContextNode オブジェクトのいずれかの子孫が参照する必要があります。参照しない場合は、ArgumentException が発生します。

ContextNode オブジェクトまたは destinationNode のどちらかが確認済みの場合、例外が発生します。

次の例では、InkDrawingNode オブジェクトのコレクションで構成される、inkDrawingsToCombine という名前の ContextNodeCollection を使用します。例では、ReparentStrokes メソッドを使用して、1 つの InkDrawingNode オブジェクトに結合します。

Dim firstNode As InkDrawingNode = CType(inkDrawingsToCombine(0), InkDrawingNode)
Dim drawingNode As InkDrawingNode
For Each drawingNode In  inkDrawingsToCombine
    ' Skip first stroke
    If drawingNode = firstNode Then
        GoTo ContinueForEach1
    End If 
    ' Reparent all strokes to the first node
    drawingNode.ReparentStrokes(drawingNode.Strokes, firstNode)

    ' Delete this node
    drawingNode.ParentNode.DeleteSubNode(drawingNode)
ContinueForEach1:
Next drawingNode
InkDrawingNode firstNode = (InkDrawingNode)inkDrawingsToCombine[0];
foreach (InkDrawingNode drawingNode in inkDrawingsToCombine)
{
    // Skip first stroke
    if (drawingNode == firstNode)
        continue;

    // Reparent all strokes to the first node
    drawingNode.ReparentStrokes(drawingNode.Strokes, firstNode);

    // Delete this node
    drawingNode.ParentNode.DeleteSubNode(drawingNode);
}

プラットフォーム

Windows Vista

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

ContextNode クラス

ContextNode メンバ

System.Windows.Ink 名前空間