Sdílet prostřednictvím


InkAnalyzerBase.GetTextRangeFromNodes Method

Finds the text range in the recognized string that corresponds to a collection of context nodes.

Namespace:  System.Windows.Ink.AnalysisCore
Assembly:  IACore (in IACore.dll)

Syntax

'Declaration
Public Sub GetTextRangeFromNodes ( _
    nodesToSearch As ContextNodeBaseCollection, _
    <OutAttribute> ByRef start As Integer, _
    <OutAttribute> ByRef length As Integer _
)
'Usage
Dim instance As InkAnalyzerBase 
Dim nodesToSearch As ContextNodeBaseCollection 
Dim start As Integer 
Dim length As Integer

instance.GetTextRangeFromNodes(nodesToSearch, _
    start, length)
public void GetTextRangeFromNodes(
    ContextNodeBaseCollection nodesToSearch,
    out int start,
    out int length
)
public:
void GetTextRangeFromNodes(
    ContextNodeBaseCollection^ nodesToSearch, 
    [OutAttribute] int% start, 
    [OutAttribute] int% length
)
public function GetTextRangeFromNodes(
    nodesToSearch : ContextNodeBaseCollection, 
    start : int, 
    length : int
)

Parameters

  • start
    Type: System.Int32%

    When this method returns, the start parameter contains a 32-bit signed integer that indicates the start of the text range. This parameter is passed uninitialized.

  • length
    Type: System.Int32%

    When this method returns, the length parameter contains a 32-bit signed integer that indicates the length of the text range. This parameter is passed uninitialized.

Remarks

If nodesToSearch contains ContextNodeBase objects that are not consecutive, then this method returns the smallest text range that covers all of the context nodes.

This method throws a System.ArgumentException when nodesToSearch contains a context node that is not associated with the InkAnalyzerBase.

Examples

The following example retrieves the text range for the first line node of the InkAnalyzerBase, theInkAnalyzerBase.

' Get all line nodes. 
Dim theLineNodes As System.Windows.Ink.AnalysisCore.ContextNodeBaseCollection = _
    theInkAnalyzerBase.FindNodesOfType( _
        System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line)

' Remove all but the first line node. 
If 0 < theLineNodes.Count Then 
    Dim firstLineNode As System.Windows.Ink.AnalysisCore.ContextNodeBase = theLineNodes(0)
    theLineNodes.Clear()
    theLineNodes.Add(firstLineNode)
End If 

' Get the text range for the first line node. 
Dim selectionStart As Integer = 0
Dim selectionLength As Integer = 0
If 0 < theLineNodes.Count Then
    theInkAnalyzerBase.GetTextRangeFromNodes( _
        theLineNodes, selectionStart, selectionLength)
End If
// Get all line nodes.
System.Windows.Ink.AnalysisCore.ContextNodeBaseCollection theLineNodes =
    theInkAnalyzerBase.FindNodesOfType(
        System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line);

// Remove all but the first line node. 
if (0 < theLineNodes.Count)
{
    System.Windows.Ink.AnalysisCore.ContextNodeBase firstLineNode = theLineNodes[0];
    theLineNodes.Clear();
    theLineNodes.Add(firstLineNode);
}

// Get the text range for the first line node. 
int selectionStart = 0;
int selectionLength = 0;
if (0 < theLineNodes.Count)
{
    theInkAnalyzerBase.GetTextRangeFromNodes(
        theLineNodes, out selectionStart, out selectionLength);
}

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkAnalyzerBase Class

InkAnalyzerBase Members

System.Windows.Ink.AnalysisCore Namespace

InkAnalyzerBase.GetNodesFromTextRange