InkAnalyzerBase.GetNodesFromTextRange 方法 (Int32%, Int32%, ContextNodeBaseCollection)

返回与指定节点的指定文本范围相关的上下文节点的集合。

命名空间:  System.Windows.Ink.AnalysisCore
程序集:  IACore(在 IACore.dll 中)

语法

声明
Public Function GetNodesFromTextRange ( _
    ByRef start As Integer, _
    ByRef length As Integer, _
    nodesToSearch As ContextNodeBaseCollection _
) As ContextNodeBaseCollection
用法
Dim instance As InkAnalyzerBase
Dim start As Integer
Dim length As Integer
Dim nodesToSearch As ContextNodeBaseCollection
Dim returnValue As ContextNodeBaseCollection

returnValue = instance.GetNodesFromTextRange(start, _
    length, nodesToSearch)
public ContextNodeBaseCollection GetNodesFromTextRange(
    ref int start,
    ref int length,
    ContextNodeBaseCollection nodesToSearch
)
public:
ContextNodeBaseCollection^ GetNodesFromTextRange(
    int% start, 
    int% length, 
    ContextNodeBaseCollection^ nodesToSearch
)
public ContextNodeBaseCollection GetNodesFromTextRange(
    /** @ref */int start,
    /** @ref */int length,
    ContextNodeBaseCollection nodesToSearch
)
public function GetNodesFromTextRange(
    start : int, 
    length : int, 
    nodesToSearch : ContextNodeBaseCollection
) : ContextNodeBaseCollection

参数

  • start
    类型:System.Int32%
    对已识别字符串中文本范围的起点的引用。
  • length
    类型:System.Int32%
    对已识别字符串中文本范围的长度的引用。

返回值

类型:System.Windows.Ink.AnalysisCore.ContextNodeBaseCollection
与指定上下文节点的指定文本范围相关的上下文节点的集合。

备注

此方法通过将文本范围扩展到最近的单词边界来修改 start 和 length 参数的值。

备注

start 和 length 参数相对于 nodesToSearch 参数的已识别字符串。

例如,如果已识别字符串为“I am late”,并通过将参数值 6 和 1 分别用于 start 和 length(这对应于“late”中的字母“a”)来调用此方法,则此方法返回一个包含单个 ContextNodeBase 的集合。该集合包含对应于单词“late”的墨迹单词或文本单词节点。对于此示例,此方法还将 start 的值修改为 5,并将 length 的值修改为 4,这对应于单词“late”。

示例

下面的示例获取包含 ContextNodeBaseCollection (theLineNodes) 的最佳识别字符串的前 5 个字符的上下文节点。在此示例中,theLineNodes 包含在 InkAnalyzerBase (theInkAnalyzerBase) 中。此示例检索这些节点的分析备选项,然后使用帮助器方法 ShowAlternates 显示这些备选项。

If 5 < theRecognizedString.Length Then
    ' Get the nodes that correspond to the first five
    ' characters of the results for the line nodes.
    Dim selectionStart As Integer = 0
    Dim selectionLength As Integer = 5
    Dim selectedSubNodes As System.Windows.Ink.AnalysisCore.ContextNodeBaseCollection = _
        theInkAnalyzerBase.GetNodesFromTextRange( _
            selectionStart, selectionLength, theLineNodes)

    ' Get analysis alternates for corresponding nodes.
    Dim theAlternates As System.Windows.Ink.AnalysisCore.AnalysisAlternateBaseCollection = _
        theInkAnalyzerBase.GetAlternates(selectedSubNodes)

    ' Display the alternates using a helper method.
    Me.ShowAlternates("Alternates for the selection:", theAlternates)
End If
if (5 < theRecognizedString.Length)
{
    // Get the nodes that correspond to the first five
    // characters of the results for the line nodes.
    int selectionStart = 0;
    int selectionLength = 5;
    System.Windows.Ink.AnalysisCore.ContextNodeBaseCollection selectedSubNodes =
        theInkAnalyzerBase.GetNodesFromTextRange(
            ref selectionStart, ref selectionLength, theLineNodes);

    // Get analysis alternates for corresponding nodes.
    System.Windows.Ink.AnalysisCore.AnalysisAlternateBaseCollection theAlternates =
        theInkAnalyzerBase.GetAlternates(selectedSubNodes);

    // Display the alternates using a helper method.
    this.ShowAlternates(
        "Alternates for the selection:", theAlternates);
}

平台

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

InkAnalyzerBase 类

InkAnalyzerBase 成员

GetNodesFromTextRange 重载

System.Windows.Ink.AnalysisCore 命名空间

InkAnalyzerBase.GetTextRangeFromNodes