返回后代 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 RootNode
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 对象的集合,这些对象对应于后代节点集合内已识别字符串中的指定文本范围。
备注
start 和 length 参数为引用值,可以进行更改以指定与返回的 ContextNodeCollection 相关联的整个字符串。例如,GetRecognizedString 的返回值是“I am late”,并且传入的值为 start = 6 和 length = 1(这些参数对应于字母“a”)。因此,ContextNodeCollection 可能只包含一个 ContextNode,即对应于单词“late”的 InkWordNode。在此示例中,start 的值更改为 5,而 length 的值更改为 4(对应于整个单词“late”)。
备注
start 参数相对于 subTree 参数中的节点。在前面的示例中,如果向 subTree 参数传入“am”的节点和“late”的节点,而不传入“I”的节点,则 start 参数 3、长度 4 表示单词“late”的文本范围。
示例
下面的示例使用 GetNodesFromTextRange 方法标记对应于所选文本的笔画。该示例代码假定名为 theResultsTextBox 的 TextBox 的 Text 属性设置为 GetRecognizedString 方法返回的值。另外,该示例还假定用户已在 theResultsTextBox 中选择了某些文本,并且存在一个名为 theInkAnalyzer 的 InkAnalyzer。
' Get the nodes that correspond to this start and length
Dim selectedNodes As ContextNodeCollection = _
theRootNode.GetNodesFromTextRange(start, length, lastRegionCollection)
' Set all strokes to black
For Each stroke As Stroke In theRootNode.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
End Sub 'showLastWritingRegion_Click
// Get the nodes that correspond to this start and length
ContextNodeCollection selectedNodes =
theRootNode.GetNodesFromTextRange(ref start, ref length, lastRegionCollection);
// Set all strokes to black
foreach (Stroke stroke in theRootNode.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