傳回子代 ContextNode 物件的集合,這些子代物件來自子代節點集合內已辨識字串中指定的文字範圍。
命名空間: Microsoft.Ink
組件: Microsoft.Ink.Analysis (在 Microsoft.Ink.Analysis.dll 中)
語法
'宣告
Public Function GetNodesFromTextRange ( _
ByRef start As Integer, _
ByRef length As Integer, _
subTree As ContextNodeCollection _
) As ContextNodeCollection
'用途
Dim instance As WritingRegionNode
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%
已辨識字串中,subTree 部份的文字範圍起點。
- length
型別:System.Int32%
已辨識字串中文字範圍的長度。
- subTree
型別:Microsoft.Ink.ContextNodeCollection
要縮小搜尋範圍的子代 ContextNode 物件。
傳回值
型別:Microsoft.Ink.ContextNodeCollection
已辨識字串中指定之文字範圍內的子代 ContextNode 物件。這些節點限於 subTree 的子代。
備註
start 和 length 參數都是參考,因為它們的值可以變更。如果 GetRecognizedString 的傳回值是 "I am late",而且您傳入的 start = 6 和 length = 1 等值,對應於 "a" 這個字母,則 ContextNodeCollection 可能只有一個 ContextNode,也就是對應於 "late" 一字的 InkWordNode。在此情況下,start 的值會變更為 5,而且 length 的值會變更為 4,對應於 "late" 這一整個字。
注意:start 參數與此 WritingRegionNode 之已辨識字串的 subTree 部分中的節點相關,而不是整個 WritingRegionNode 或整個 RootNode 的已辨識字串。在先前的範例中,如果您傳入的 subTree 參數有 "am" 和 "late" 節點,但沒有 "I" 節點,start 參數值 3 和長度值 4 則表示 "late" 一字的文字範圍。
範例
下列範例會採用 ContextNodeCollection 物件 lastParagraphLevelCollection,其中包含對應於 WritingRegionNode (writingRegion) 中最後一個段落的一個 ContextNode 物件。接著它會將所有的 Strokes 標記為黑色,但會將最後一個段落中的筆劃變更為紅色。
' Get the nodes that correspond to this start and length
Dim selectedNodes As ContextNodeCollection = _
writingRegion.GetNodesFromTextRange(start, length, lastParagraphCollection)
' Set all strokes to black
Dim inkStroke As Stroke
For Each inkStroke In writingRegion.Strokes
inkStroke.DrawingAttributes = New DrawingAttributes(Color.Black)
Next inkStroke
' Set strokes in the collection to red
Dim node As ContextNode
For Each node In selectedNodes
For Each inkStroke In node.Strokes
inkStroke.DrawingAttributes = New DrawingAttributes(Color.Red)
Next inkStroke
Next node
// Get the nodes that correspond to this start and length
ContextNodeCollection selectedNodes =
writingRegion.GetNodesFromTextRange(ref start, ref length, lastParagraphCollection);
// Set all strokes to black
foreach (Stroke stroke in writingRegion.Strokes)
stroke.DrawingAttributes = new DrawingAttributes(Color.Black);
// Set strokes in the collection to red
foreach (ContextNode node in selectedNodes)
{
foreach (Stroke stroke in node.Strokes)
{
stroke.DrawingAttributes = new DrawingAttributes(Color.Red);
}
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0