認識された文字列の指定したテキスト範囲に関連する子孫 ContextNode オブジェクトのコレクションを返します。
名前空間 : System.Windows.Ink
アセンブリ : IAWinFX (IAWinFX.dll 内)
構文
'宣言
Public Function GetNodesFromTextRange ( _
ByRef start As Integer, _
ByRef length As Integer _
) As ContextNodeCollection
'使用
Dim instance As CustomRecognizerNode
Dim start As Integer
Dim length As Integer
Dim returnValue As ContextNodeCollection
returnValue = instance.GetNodesFromTextRange(start, _
length)
public ContextNodeCollection GetNodesFromTextRange(
ref int start,
ref int length
)
public:
ContextNodeCollection^ GetNodesFromTextRange(
int% start,
int% length
)
public ContextNodeCollection GetNodesFromTextRange(
/** @ref */int start,
/** @ref */int length
)
public function GetNodesFromTextRange(
start : int,
length : int
) : ContextNodeCollection
パラメータ
- start
型 : System.Int32%
認識された文字列のテキスト範囲の開始位置。
- length
型 : System.Int32%
認識された文字列のテキスト範囲の長さ。
戻り値
型 : System.Windows.Ink.ContextNodeCollection
認識された文字列の指定したテキスト範囲に関連する子孫 ContextNode オブジェクトのコレクションを返します。
解説
指定したテキスト範囲は、RootNode 全体の認識された文字列ではなく、この CustomRecognizerNode の認識された文字列に関連しています。
例
次の例では、selectedResultsTextBox という名前の TextBox を使用します。Text プロパティは既に、CustomRecognizerNode オブジェクト、customRecognizer の GetRecognizedString によってに返された値に設定されています。ユーザーは、TextBox にあるテキストの一部を選択しています。InkRecognitionConfidence レベルが Strong() である場合、ユーザーが選択したテキストに対応する Strokes が赤色で強調表示されます。
' Find out what's been selected in the text box
Dim start As Integer = selectedResultsTextBox.SelectionStart
Dim length As Integer = selectedResultsTextBox.SelectionLength
' Return if no text is selected.
If length = 0 Then
Return
End If
' Only highlight if strong recognition
If customRecognizer.InkRecognitionConfidence = _
InkRecognitionConfidence.Strong Then
Dim selectedNodes As ContextNodeCollection = _
customRecognizer.GetNodesFromTextRange(start, length)
' Use the new start and length value to update the
' selection in the TextBox
selectedResultsTextBox.SelectionStart = start
selectedResultsTextBox.SelectionLength = length
' Color the strokes red if part of the selected words.
' Otherwise, color them black.
For Each Stroke As Stroke In customRecognizer.Strokes
Stroke.DrawingAttributes.Color = Colors.Black
Next Stroke
For Each selectedNode As ContextNode In selectedNodes
For Each Stroke As Stroke In selectedNode.Strokes
Stroke.DrawingAttributes.Color = Colors.Red
Next Stroke
Next selectedNode
End If
// Find out what's been selected in the text box
int start = selectedResultsTextBox.SelectionStart;
int length = selectedResultsTextBox.SelectionLength;
// Return if no text is selected.
if (length == 0)
return;
// Only highlight if strong recognition
if (customRecognizer.InkRecognitionConfidence == InkRecognitionConfidence.Strong)
{
ContextNodeCollection selectedNodes =
customRecognizer.GetNodesFromTextRange(ref start, ref length);
// Use the new start and length value to update the
// selection in the TextBox
selectedResultsTextBox.SelectionStart = start;
selectedResultsTextBox.SelectionLength = length;
// Color the strokes red if part of the selected words.
// Otherwise, color them black.
foreach (Stroke stroke in customRecognizer.Strokes)
{
stroke.DrawingAttributes.Color = Colors.Black;
}
foreach (ContextNode selectedNode in selectedNodes)
{
foreach (Stroke stroke in selectedNode.Strokes)
{
stroke.DrawingAttributes.Color = Colors.Red;
}
}
}
プラットフォーム
Windows Vista
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 3.0