尋找對應至 ContextNode 物件集合之已辨識字串中的文字範圍。
命名空間: System.Windows.Ink
組件: IAWinFX (在 IAWinFX.dll 中)
語法
'宣告
Public Sub GetTextRangeFromNodes ( _
nodesToSearch As ContextNodeCollection, _
<OutAttribute> ByRef start As Integer, _
<OutAttribute> ByRef length As Integer _
)
'用途
Dim instance As InkAnalyzer
Dim nodesToSearch As ContextNodeCollection
Dim start As Integer
Dim length As Integer
instance.GetTextRangeFromNodes(nodesToSearch, _
start, length)
public void GetTextRangeFromNodes(
ContextNodeCollection nodesToSearch,
out int start,
out int length
)
public:
void GetTextRangeFromNodes(
ContextNodeCollection^ nodesToSearch,
[OutAttribute] int% start,
[OutAttribute] int% length
)
public void GetTextRangeFromNodes(
ContextNodeCollection nodesToSearch,
/** @attribute OutAttribute */ /** @ref */int start,
/** @attribute OutAttribute */ /** @ref */int length
)
public function GetTextRangeFromNodes(
nodesToSearch : ContextNodeCollection,
start : int,
length : int
)
參數
- nodesToSearch
型別:System.Windows.Ink.ContextNodeCollection
ContextNode 物件的集合,這些物件組成文字範圍。
- start
型別:System.Int32%
這個方法傳回時,start 參數會包含 32 位元帶正負號的整數,這個整數表示文字範圍的起點。這個參數傳入時尚未經過初始化。
- length
型別:System.Int32%
這個方法傳回時,length 參數會包含 32 位元帶正負號的整數,這個整數表示文字範圍的長度。這個參數傳入時尚未經過初始化。
備註
如果 nodesToSearch 包含彼此不相鄰的 ContextNode 物件,這個方法會傳回涵蓋所有 ContextNode 物件的最小文字範圍。
當 nodesToSearch 包含與 InkAnalyzer 沒有關聯的 ContextNode 時,這個方法會擲回 ArgumentException。
範例
這個範例會定義名為 SelectTextRangeFromNodes 的方法,該方法會將 TextBox (名為 theResultsTextBox) 的文字設定為 InkAnalyzer (名為 theInkAnalyzer) 的辨識字串。接著會將文字方塊選取範圍設定為跨越 theContextNodes 參數的已辨識文字。
Private Sub SelectTextRangeFromNodes(ByVal theContextNodes As ContextNodeCollection)
' Set the text of theResultsTextBox.
Me.theResultsTextBox.Text = Me.theInkAnalyzer.GetRecognizedString()
' Get the text range for theContextNodes.
Dim theStart As Integer
Dim theLength As Integer
Me.theInkAnalyzer.GetTextRangeFromNodes(theContextNodes, theStart, theLength)
' Select the text range in the TextBox.
Me.theResultsTextBox.Select(theStart, theLength)
End Sub 'SelectTextRangeFromNodes
private void SelectTextRangeFromNodes(ContextNodeCollection theContextNodes)
{
// Set the text of theResultsTextBox.
this.theResultsTextBox.Text = this.theInkAnalyzer.GetRecognizedString();
// Get the text range for theContextNodes.
int theStart;
int theLength;
this.theInkAnalyzer.GetTextRangeFromNodes(
theContextNodes, out theStart, out theLength);
// Select the text range in the TextBox.
this.theResultsTextBox.Select(theStart, theLength);
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0