Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns a ContextNodeCollection containing ContextNode objects that pertain to the specified text range for the specified context nodes.
Namespace: System.Windows.Ink
Assembly: IAWinFX (in IAWinFX.dll)
Syntax
'Declaration
Public Function GetNodesFromTextRange ( _
ByRef start As Integer, _
ByRef length As Integer, _
nodesToSearch As ContextNodeCollection _
) As ContextNodeCollection
'Usage
Dim instance As InkAnalyzer
Dim start As Integer
Dim length As Integer
Dim nodesToSearch As ContextNodeCollection
Dim returnValue As ContextNodeCollection
returnValue = instance.GetNodesFromTextRange(start, _
length, nodesToSearch)
public ContextNodeCollection GetNodesFromTextRange(
ref int start,
ref int length,
ContextNodeCollection nodesToSearch
)
public:
ContextNodeCollection^ GetNodesFromTextRange(
int% start,
int% length,
ContextNodeCollection^ nodesToSearch
)
public function GetNodesFromTextRange(
start : int,
length : int,
nodesToSearch : ContextNodeCollection
) : ContextNodeCollection
Parameters
- start
Type: System.Int32%
- length
Type: System.Int32%
nodesToSearch
Type: System.Windows.Ink.ContextNodeCollectionThe ContextNode objects used to limit the search.
Return Value
Type: System.Windows.Ink.ContextNodeCollection
The ContextNode objects that are relevant to the specified text range for the specified context nodes.
Remarks
The specified text range must be relative to the nodesToSearch portion of the recognized string from the InkAnalyzer.
This method modifies the values of the start and length parameters by expanding the text range to the nearest word boundaries. 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 either: a single ContextNode, the InkWordNode or the TextWordNode. For this example, the method also modifies the value of start to 5 and the value of length to 4 (which corresponds to the word "late").
Note
The start parameter is relative to the recognized string of the nodesToSearch parameter.
Examples
This example takes a TextBox named theResultsTextBox, whose Text property has been set to the combined recognized strings of the nodes in the ContextNodeCollection named nodesToSearch. The nodesToSearch collection contains context nodes from the InkAnalyzer, named theInkAnalyzer. The example code takes the text box selection and marks the Strokes corresponding to that selection.
' Find out what's been selected in the text box
Dim selStart As Integer = theResultsTextBox.SelectionStart
Dim selLength As Integer = theResultsTextBox.SelectionLength
' Get the nodes that correspond to that range
Dim selectedSubNodes As ContextNodeCollection = _
Me.theInkAnalyzer.GetNodesFromTextRange(selStart, selLength, nodesToSearch)
' Use the new start and length value to update the
' selection in the TextBox
theResultsTextBox.SelectionStart = selStart
theResultsTextBox.SelectionLength = selLength
' First, set all strokes to black
For Each theStroke As Stroke In Me.theInkAnalyzer.RootNode.Strokes
theStroke.DrawingAttributes.Color = Colors.Black
Next theStroke
' Next, set all selected sub nodes to red
Dim theContextNode As ContextNode
For Each theContextNode In selectedSubNodes
For Each theStroke As Stroke In theContextNode.Strokes
theStroke.DrawingAttributes.Color = Colors.Red
Next theStroke
Next theContextNode
// Find out what's been selected in the text box
int selStart = theResultsTextBox.SelectionStart;
int selLength = theResultsTextBox.SelectionLength;
// Get the nodes that correspond to that range
ContextNodeCollection selectedSubNodes =
this.theInkAnalyzer.GetNodesFromTextRange(
ref selStart, ref selLength, nodesToSearch);
// Use the new start and length value to update the
// selection in the TextBox
theResultsTextBox.SelectionStart = selStart;
theResultsTextBox.SelectionLength = selLength;
// First, set all strokes to black
foreach (Stroke theStroke
in this.theInkAnalyzer.RootNode.Strokes)
{
theStroke.DrawingAttributes.Color = Colors.Black;
}
// Next, set all selected sub nodes to red
foreach (ContextNode theContextNode in selectedSubNodes)
{
foreach (Stroke theStroke in theContextNode.Strokes)
{
theStroke.DrawingAttributes.Color = Colors.Red;
}
}
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