認識された文字列の中の指定されたテキスト範囲に対応する子孫 ContextNode オブジェクトのコレクション (特定の子孫ノード コレクション内に限定) を返します。
名前空間 : System.Windows.Ink
アセンブリ : IAWinFX (IAWinFX.dll 内)
構文
'宣言
Public Function GetNodesFromTextRange ( _
ByRef start As Integer, _
ByRef length As Integer, _
subTree As ContextNodeCollection _
) As ContextNodeCollection
'使用
Dim instance As CustomRecognizerNode
Dim start As Integer
Dim length As Integer
Dim subTree As ContextNodeCollection
Dim returnValue As ContextNodeCollection
returnValue = instance.GetNodesFromTextRange(start, _
length, subTree)
public ContextNodeCollection GetNodesFromTextRange(
ref int start,
ref int length,
ContextNodeCollection subTree
)
public:
ContextNodeCollection^ GetNodesFromTextRange(
int% start,
int% length,
ContextNodeCollection^ subTree
)
public ContextNodeCollection GetNodesFromTextRange(
/** @ref */int start,
/** @ref */int length,
ContextNodeCollection subTree
)
public function GetNodesFromTextRange(
start : int,
length : int,
subTree : ContextNodeCollection
) : ContextNodeCollection
パラメータ
- start
型 : System.Int32%
- length
型 : System.Int32%
- subTree
型 : System.Windows.Ink.ContextNodeCollection
検索範囲を絞る子孫 ContextNode オブジェクト。
戻り値
型 : System.Windows.Ink.ContextNodeCollection
認識された文字列の中の指定されたテキスト範囲に対応する子孫 ContextNode オブジェクトのコレクション (特定の子孫ノード コレクション内に限定)。
解説
指定したテキスト範囲は、[T:System.Windows.Ink. CustomRecognizerNode] 全体または RootNode 全体で認識された文字列ではなく、この CustomRecognizerNode で認識された文字列の subTree 部分に対応しています。
start パラメータおよび length パラメータは、値が変更されることがあるため参照用です。たとえば、GetRecognizedString の戻り値が "I am late" のときに、"a" に対応する値 start = 6 および length = 1 を渡した場合、ContextNodeCollection の ContextNode は 1 つのみとなる可能性が高くなります。この ContextNode は、単語 "late" に対応する InkWordNode になります。この場合、start の値は 5 に、length の値は 4 ("late" という単語の長さ) に変更されます。
メモstart パラメータは、subTree パラメータ内のノードに対応しています。前の例では、"am" および "late" のノードを持つが、"I" のノードは持たない subTree パラメータを渡した場合、start パラメータが 3 で長さが 4 の場合は、"late" という語のテキスト範囲です。
例
次の例では、ContextNodeCollection オブジェクト、lastLineCollection を受け取ります。このオブジェクトには、(customRecognizer という名前の CustomRecognizerNode 内の最後の行に対応する 1 つの ContextNode オブジェクトが含まれます。次に、最後の行で選択したテキストに対応する部分は赤色で、それ以外のすべての Strokes は黒色でマークされます。
' Get the nodes that correspond to this start and length
Dim selectedNodes As ContextNodeCollection = _
customRecognizer.GetNodesFromTextRange(start, length, lastLineCollection)
' Set all strokes to black
For Each stroke As Stroke In customRecognizer.Strokes
stroke.DrawingAttributes.Color = Colors.Black
Next stroke
' Set strokes in the collection to red
For Each node As ContextNode In selectedNodes
For Each stroke As Stroke In node.Strokes
stroke.DrawingAttributes.Color = Colors.Red
Next stroke
Next node
// Get the nodes that correspond to this start and length
ContextNodeCollection selectedNodes =
customRecognizer.GetNodesFromTextRange(ref start, ref length, lastLineCollection);
// Set all strokes to black
foreach (Stroke stroke in customRecognizer.Strokes)
stroke.DrawingAttributes.Color = Colors.Black;
// Set strokes in the collection to red
foreach (ContextNode node in selectedNodes)
{
foreach (Stroke stroke in node.Strokes)
{
stroke.DrawingAttributes.Color = Colors.Red;
}
}
プラットフォーム
Windows Vista
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 3.0