InkAnalyzer.GetTextRangeFromNodes 方法

查找已识别字符串中对应于 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
)

参数

  • 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

另请参见

参考

InkAnalyzer 类

InkAnalyzer 成员

System.Windows.Ink 命名空间