傳回 Strokes 集合,這個集合對應至最小辨識區段組,其中含有替代項目內指定的字元範圍。
命名空間: Microsoft.Ink
組件: Microsoft.Ink (在 Microsoft.Ink.dll 中)
語法
'宣告
Public Function GetStrokesFromTextRange ( _
ByRef selectionStart As Integer, _
ByRef selectionLength As Integer _
) As Strokes
'用途
Dim instance As RecognitionAlternate
Dim selectionStart As Integer
Dim selectionLength As Integer
Dim returnValue As Strokes
returnValue = instance.GetStrokesFromTextRange(selectionStart, _
selectionLength)
public Strokes GetStrokesFromTextRange(
ref int selectionStart,
ref int selectionLength
)
public:
Strokes^ GetStrokesFromTextRange(
int% selectionStart,
int% selectionLength
)
public Strokes GetStrokesFromTextRange(
/** @ref */int selectionStart,
/** @ref */int selectionLength
)
public function GetStrokesFromTextRange(
selectionStart : int,
selectionLength : int
) : Strokes
參數
- selectionStart
型別:System.Int32%
這個替代項目內的起始字元範圍。
- selectionLength
型別:System.Int32%
這個替代項目內的字元範圍長度。這個參數必須大於 0,而且會調整成最小區段組 (由一個或多個含有選取輸入的區段組成) 的長度。
傳回值
型別:Microsoft.Ink.Strokes
傳回 Strokes 集合,這個集合對應至最小辨識區段組,其中含有替代項目內指定的字元範圍。
備註
selectionStart 位置處的字元會包含在文字辨識範圍內。這個參數會調整成最小辨識的區段組 (由一個或多個含有選取輸入的區段組成) 的開頭。selectionStart 參數是以零起始的索引,會成為辨識替代項目文字內的字元。
以已經辨識出且最佳替代項目是 "how are you" 的 Strokes 集合為例,傳遞至這個方法的參數是此字串結果內的部分範圍 (或可能所有範圍)。此替代項目包含五個區段,每個字一個區段且每個空格一個區段。傳回的筆劃對應至含有所有輸入範圍的最小區段組。如果 selectionStart 參數為 0 且 selectionLength 參數為 5,建立對應至結果字串 "how a" 的範圍的話,則傳回的筆劃都是構成 "how are" 區段的所有辨識筆劃。這是含有輸入範圍的最小區段組。
以單字為主和以字元為主的辨識器都將空格當成字元。如果選取輸入對應至空格字元,則這個方法會傳回空的 Strokes 集合。
範例
這個 C# 範例會尋找 Strokes 集合 (變數名稱為 altStrokes),它與含有文字範圍的最小 RecognitionAlternate 物件組相關聯。
[C#]
theTextBox.Text = theRecognitionResult.TopString;
//... Assume the user has selected a range within theTextBox.
int selStart = theTextBox.SelectionStart;
int selLength = theTextBox.SelectionLength;
Strokes altStrokes;
altStrokes = theRecognitionResult.TopAlternate.GetStrokesFromTextRange(
ref selStart, ref selLength);
這個 Microsoft® Visual Basic® .NET 範例會尋找 Strokes 集合 (變數名稱為 altStrokes),它與含有文字範圍的最小 RecognitionAlternate 物件組相關聯。
[Visual Basic]
theTextBox.Text = theRecognitionResult.TopString
'... Assume the user has selected a range within theTextBox.
Dim selStart As Integer = theTextBox.SelectionStart
Dim selLength As Integer = theTextBox.SelectionLength
Dim altStrokes As Strokes
altStrokes = theRecognitionResult.TopAlternate.GetStrokesFromTextRange( _
selStart, selLength)
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0
請參閱
參考
RecognitionAlternate.GetStrokesFromStrokeRanges