指定したコンテキスト ノードの指定したテキスト範囲に関連する ContextNode オブジェクトを含む ContextNodeCollection を返します。
名前空間 : System.Windows.Ink
アセンブリ : IAWinFX (IAWinFX.dll 内)
構文
'宣言
Public Function GetNodesFromTextRange ( _
ByRef start As Integer, _
ByRef length As Integer, _
nodesToSearch As ContextNodeCollection _
) As ContextNodeCollection
'使用
Dim instance As InkAnalyzer
Dim start As Integer
Dim length As Integer
Dim nodesToSearch As ContextNodeCollection
Dim returnValue As ContextNodeCollection
returnValue = instance.GetNodesFromTextRange(start, _
length, nodesToSearch)
public ContextNodeCollection GetNodesFromTextRange(
ref int start,
ref int length,
ContextNodeCollection nodesToSearch
)
public:
ContextNodeCollection^ GetNodesFromTextRange(
int% start,
int% length,
ContextNodeCollection^ nodesToSearch
)
public ContextNodeCollection GetNodesFromTextRange(
/** @ref */int start,
/** @ref */int length,
ContextNodeCollection nodesToSearch
)
public function GetNodesFromTextRange(
start : int,
length : int,
nodesToSearch : ContextNodeCollection
) : ContextNodeCollection
パラメータ
- start
型 : System.Int32%
- length
型 : System.Int32%
- nodesToSearch
型 : System.Windows.Ink.ContextNodeCollection
検索範囲を限定するために使用される ContextNode オブジェクト。
戻り値
型 : System.Windows.Ink.ContextNodeCollection
指定したコンテキスト ノードの指定したテキスト範囲に関連する ContextNode オブジェクト。
解説
指定したテキスト範囲は、InkAnalyzer からの認識された文字列の nodesToSearch 部分に関連している必要があります。
このメソッドは、テキスト範囲を最も近い単語境界に拡張することにより、start パラメータおよび length パラメータの値を変更します。たとえば、認識された文字列が "I am late" の場合に、start にパラメータ値 6 を使用し、length にパラメータ値 1 を使用して ("late" の文字 "a" に対応する) このメソッドを呼び出すと、このメソッドは単一の ContextNode、InkWordNode または TextWordNode が含まれているコレクションを返します。この例では、メソッドはさらに start の値を 5 に変更し、length の値を 4 に変更します (単語 "late" に対応する)。
![]() |
---|
start パラメータは、nodesToSearch パラメータの認識された文字列に関連しています。 |
例
この例では、Text プロパティが、nodesToSearch という名前の ContextNodeCollection 内のノードの、結合された認識された文字列に設定されている、theResultsTextBox という名前の TextBox を取得します。nodesToSearch コレクションには、theInkAnalyzer という名前の InkAnalyzer のコンテキスト ノードが含まれています。コード例では、テキスト ボックスの選択内容が使用され、その選択内容に対応する Strokes がマークされます。
' Find out what's been selected in the text box
Dim selStart As Integer = theResultsTextBox.SelectionStart
Dim selLength As Integer = theResultsTextBox.SelectionLength
' Get the nodes that correspond to that range
Dim selectedSubNodes As ContextNodeCollection = _
Me.theInkAnalyzer.GetNodesFromTextRange(selStart, selLength, nodesToSearch)
' Use the new start and length value to update the
' selection in the TextBox
theResultsTextBox.SelectionStart = selStart
theResultsTextBox.SelectionLength = selLength
' First, set all strokes to black
For Each theStroke As Stroke In Me.theInkAnalyzer.RootNode.Strokes
theStroke.DrawingAttributes.Color = Colors.Black
Next theStroke
' Next, set all selected sub nodes to red
Dim theContextNode As ContextNode
For Each theContextNode In selectedSubNodes
For Each theStroke As Stroke In theContextNode.Strokes
theStroke.DrawingAttributes.Color = Colors.Red
Next theStroke
Next theContextNode
// Find out what's been selected in the text box
int selStart = theResultsTextBox.SelectionStart;
int selLength = theResultsTextBox.SelectionLength;
// Get the nodes that correspond to that range
ContextNodeCollection selectedSubNodes =
this.theInkAnalyzer.GetNodesFromTextRange(
ref selStart, ref selLength, nodesToSearch);
// Use the new start and length value to update the
// selection in the TextBox
theResultsTextBox.SelectionStart = selStart;
theResultsTextBox.SelectionLength = selLength;
// First, set all strokes to black
foreach (Stroke theStroke
in this.theInkAnalyzer.RootNode.Strokes)
{
theStroke.DrawingAttributes.Color = Colors.Black;
}
// Next, set all selected sub nodes to red
foreach (ContextNode theContextNode in selectedSubNodes)
{
foreach (Stroke theStroke in theContextNode.Strokes)
{
theStroke.DrawingAttributes.Color = Colors.Red;
}
}
プラットフォーム
Windows Vista
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 3.0