Sdílet prostřednictvím


InkAnalyzerBase.GetNodesFromTextRange Method (Int32%, Int32%, ContextNodeBaseCollection)

Returns a collection of context nodes that are relevant to the specified text range of the specified nodes.

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

Syntax

'Declaration
Public Function GetNodesFromTextRange ( _
    ByRef start As Integer, _
    ByRef length As Integer, _
    nodesToSearch As ContextNodeBaseCollection _
) As ContextNodeBaseCollection
'Usage
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 function GetNodesFromTextRange(
    start : int, 
    length : int, 
    nodesToSearch : ContextNodeBaseCollection
) : ContextNodeBaseCollection

Parameters

  • start
    Type: System.Int32%

    A reference to the start of the text range in the recognized string.

  • length
    Type: System.Int32%

    A reference to the length of the text range in the recognized string.

Return Value

Type: System.Windows.Ink.AnalysisCore.ContextNodeBaseCollection
The collection of context nodes that are relevant to the specified text range of the specified context nodes.

Remarks

This method modifies the values of the start and length parameters by expanding the text range to the nearest word boundaries.

Note

The start and length parameters are relative to the recognized string of the nodesToSearch parameter.

For example, if the recognized string is "I am late" and you call this method using the parameter values of 6 for start and 1 for length, which corresponds to the letter "a" in "late", this method returns a collection containing a single ContextNodeBase. The collection contais the ink word or text word node that corresponds to the word "late." For this example, this method also modifies the value of start to 5 and the value of length to 4, which corresponds to the word "late".

Examples

The following example gets the context nodes that contain the first five characters of the top recognized string of the ContextNodeBaseCollection, theLineNodes. In this example, theLineNodes are contained by the InkAnalyzerBase, theInkAnalyzerBase. The example retrieves analysis alternates for these nodes and then displays the alternates using a helper method, 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);
}

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

GetNodesFromTextRange Overload

System.Windows.Ink.AnalysisCore Namespace

InkAnalyzerBase.GetTextRangeFromNodes