ContextNode オブジェクトで、指定したストロークを設定します。
名前空間 : System.Windows.Ink
アセンブリ : IAWinFX (IAWinFX.dll 内)
構文
'宣言
Public Sub SetStrokes ( _
strokes As StrokeCollection _
)
'使用
Dim instance As ContextNode
Dim strokes As StrokeCollection
instance.SetStrokes(strokes)
public void SetStrokes(
StrokeCollection strokes
)
public:
void SetStrokes(
StrokeCollection^ strokes
)
public void SetStrokes(
StrokeCollection strokes
)
public function SetStrokes(
strokes : StrokeCollection
)
パラメータ
- strokes
型 : System.Windows.Ink.StrokeCollection
ContextNode オブジェクトが取得する StrokeCollection。
解説
このメソッドは、DirtyRegion を更新しません。
ストローク コレクションの指定したストロークのいずれかが既に InkAnalyzer で設定されている場合、ArgumentException がスローされます。
例
次の例では、TreeView をドキュメント モデルとして使用して、InkAnalyzer のコンテキスト ノード ツリーの格納と読み込みにデータ プロキシを使用する方法を示す、PopulateNode というメソッドを示します。各 TreeViewItem オブジェクトの Tag プロパティが DocumentNodeData オブジェクトに設定されている場合、DocumentNodeData クラスは ContextNode データをドキュメント モデルに格納します。
PopulateNode メソッドは、InkAnalyzer オブジェクトからストローク、プロパティ データ、注釈の種類、子ノード、およびリンクを追加することにより、ContextNode オブジェクトに完全に書き込みます。SetStrokes を使用してストロークを追加します。データは、対応する TreeViewItem から取得される DocumentNodeData オブジェクトにより生成されます。
this[analyzerNode.Id] は、Guid を TreeViewItem に対応付けるドキュメント モデル クラスのインデクサです (VB.NET では Me(analyzerNode.Id))。
AddLinksToAnalyer は、ContextNode にリンクを追加するドキュメント モデル クラス上のメソッドです。
ノードに完全に書き込みが行われたら、PartiallyPopulated プロパティが false に設定されます。データ プロキシの詳細については、「Data Proxy with Ink Analysis」を参照してください。
Sub PopulateNode(ByVal analyzerNode As ContextNode, ByVal theInkAnalyzer As InkAnalyzer) Implements IDocumentModel.PopulateNode
System.Diagnostics.Debug.WriteLine(String.Format("IDocumentModel.PopulateNode: populate {0} {1}.", analyzerNode.ToString(), GetRecognizedString(analyzerNode)))
System.Diagnostics.Debug.Indent()
' Get the document node associated with the analyzer node.
Dim documentNode As TreeViewItem = Me(analyzerNode.Id)
If documentNode Is Nothing Then
Throw New ApplicationException("The requested node does not exist in the document model.")
End If
' Get the data associated with the node.
Dim nodeData As DocumentNodeData = documentNode.Tag '
' Copy any application specific data associated with the node to the
' partially populated ContextNode.
For Each identifier As Guid In nodeData.GetPropertyDataIds()
analyzerNode.AddPropertyData(identifier, nodeData.GetPropertyData(identifier))
Next identifier
' Check if the partially populated ContextNode is an ink leaf node.
If nodeData.IsInkLeafNode Then
' Add the strokes to the context node.
analyzerNode.SetStrokes(nodeData.Strokes)
Else
' Add each child subnode as a partially populated ContextNode.
Dim documentSubNode As TreeViewItem
For Each documentSubNode In documentNode.Items
' Get the DocumentNode data for the
Dim subNodeData As DocumentNodeData = documentSubNode.Tag '
If analyzerNode.SubNodes.IndexOf(nodeData.Id) <> -1 Then
analyzerNode.CreatePartiallyPopulatedSubNode( _
subNodeData.Type, subNodeData.Id, subNodeData.Location)
End If
Next documentSubNode
End If
' Add links to the ContextNode.
Me.AddLinksToAnalyzer(documentNode, analyzerNode, theInkAnalyzer)
' Update the partially populated flag.
analyzerNode.PartiallyPopulated = False
System.Diagnostics.Debug.Unindent()
End Sub 'IDocumentModel.PopulateNode
void IDocumentModel.PopulateNode(
ContextNode analyzerNode,
InkAnalyzer theInkAnalyzer)
{
System.Diagnostics.Debug.WriteLine(string.Format(
"IDocumentModel.PopulateNode: populate {0} {1}.",
analyzerNode.ToString(), GetRecognizedString(analyzerNode)));
System.Diagnostics.Debug.Indent();
// Get the document node associated with the analyzer node.
TreeViewItem documentNode = this[analyzerNode.Id];
if (null == documentNode)
{
throw new ApplicationException(
"The requested node does not exist in the document model.");
}
// Get the data associated with the node.
DocumentNodeData nodeData = documentNode.Tag as DocumentNodeData;
// Copy any application specific data associated with the node to the
// partially populated ContextNode.
foreach (Guid identifier in nodeData.GetPropertyDataIds())
{
analyzerNode.AddPropertyData(
identifier, nodeData.GetPropertyData(identifier));
}
// Check if the partially populated ContextNode is an ink leaf node.
if (nodeData.IsInkLeafNode)
{
// Add the strokes to the context node.
analyzerNode.SetStrokes(nodeData.Strokes);
}
else
{
// Add each child subnode as a partially populated ContextNode.
foreach (TreeViewItem documentSubNode in documentNode.Items)
{
// Get the DocumentNode data for the
DocumentNodeData subNodeData = documentSubNode.Tag as DocumentNodeData;
if (analyzerNode.SubNodes.IndexOf(nodeData.Id) != -1)
{
analyzerNode.CreatePartiallyPopulatedSubNode(
subNodeData.Type, subNodeData.Id, subNodeData.Location);
}
}
}
// Add links to the ContextNode.
this.AddLinksToAnalyzer(documentNode, analyzerNode, theInkAnalyzer);
// Update the partially populated flag.
analyzerNode.PartiallyPopulated = false;
System.Diagnostics.Debug.Unindent();
}
プラットフォーム
Windows Vista
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 3.0