LineNode.GetTextRangeFromNodes Method
Finds the text range in the recognized string that corresponds to a collection of ContextNode objects that are descendants of the LineNode.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)
Syntax
'Declaration
Public Sub GetTextRangeFromNodes ( _
subTree As ContextNodeCollection, _
<OutAttribute> ByRef start As Integer, _
<OutAttribute> ByRef length As Integer _
)
'Usage
Dim instance As LineNode
Dim subTree As ContextNodeCollection
Dim start As Integer
Dim length As Integer
instance.GetTextRangeFromNodes(subTree, _
start, length)
public void GetTextRangeFromNodes(
ContextNodeCollection subTree,
out int start,
out int length
)
public:
void GetTextRangeFromNodes(
ContextNodeCollection^ subTree,
[OutAttribute] int% start,
[OutAttribute] int% length
)
public function GetTextRangeFromNodes(
subTree : ContextNodeCollection,
start : int,
length : int
)
Parameters
subTree
Type: Microsoft.Ink.ContextNodeCollectionThe collection of ContextNode objects that are descendants of the LineNode.
start
Type: System.Int32%The start of the text range.
length
Type: System.Int32%The length of the text range.
Remarks
If the subTree contains a ContextNode object that is not a descendant of the LineNode, then an ArgumentException exception is thrown.
If the subTree contains ContextNode objects that are not consecutive, then the smallest text range that covers all of the ContextNode objects is returned.
Examples
The following example takes an InkWordNode, inkWord, and checks to see if its ParentNode is a LineNode. If it is, then it puts the value of GetRecognizedString into a TextBox, selectedResultsTextBox, and then selects the text that corresponds to inkWord.
Dim parentNode As ContextNode = inkWord.ParentNode
If TypeOf parentNode Is LineNode Then
Dim parentLine As LineNode = CType(parentNode, LineNode)
' Put parent line's recognized string into the text box
selectedResultsTextBox.Text = parentLine.GetRecognizedString()
' Select the text that corresponds to the ink word
Dim subNodes As New ContextNodeCollection(theInkAnalyzer)
subNodes.Add(inkWord)
Dim start As Integer
Dim length As Integer
parentLine.GetTextRangeFromNodes(subNodes, start, length)
If start >= 0 AndAlso length > 0 Then
selectedResultsTextBox.Select(start, length)
End If
End If
ContextNode parentNode = inkWord.ParentNode;
if (parentNode is LineNode)
{
LineNode parentLine = (LineNode)parentNode;
// Put parent line's recognized string into the text box
selectedResultsTextBox.Text = parentLine.GetRecognizedString();
// Select the text that corresponds to the ink word
ContextNodeCollection subNodes = new ContextNodeCollection(theInkAnalyzer);
subNodes.Add(inkWord);
int start = 0;
int length = 0;
parentLine.GetTextRangeFromNodes(subNodes, out start, out length);
if (start >= 0 && length > 0)
{
selectedResultsTextBox.Select(start, length);
}
}
Platforms
Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008
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