Condividi tramite


Metodo InkAnalyzer.GetNodesFromTextRange (Int32%, Int32%)

Aggiornamento: novembre 2007

Restituisce un oggetto ContextNodeCollection contenente gli oggetti ContextNode relativi all'intervallo di testo specificato.

Spazio dei nomi:  System.Windows.Ink
Assembly:  IAWinFX (in IAWinFX.dll)

Sintassi

'Dichiarazione
Public Function GetNodesFromTextRange ( _
    ByRef start As Integer, _
    ByRef length As Integer _
) As ContextNodeCollection
'Utilizzo
Dim instance As InkAnalyzer
Dim start As Integer
Dim length As Integer
Dim returnValue As ContextNodeCollection

returnValue = instance.GetNodesFromTextRange(start, _
    length)
public ContextNodeCollection GetNodesFromTextRange(
    ref int start,
    ref int length
)
public:
ContextNodeCollection^ GetNodesFromTextRange(
    int% start, 
    int% length
)
public ContextNodeCollection GetNodesFromTextRange(
    /** @ref */int start,
    /** @ref */int length
)
public function GetNodesFromTextRange(
    start : int, 
    length : int
) : ContextNodeCollection

Parametri

Valore restituito

Tipo: System.Windows.Ink.ContextNodeCollection
Insieme di oggetti ContextNode rilevanti per l'intervallo di testo specificato.

Note

L'intervallo di testo specificato deve essere relativo alla stringa riconosciuta dell'intero oggetto InkAnalyzer.

Questo metodo modifica i valori dei parametri start e length espandendo l'intervallo di testo ai limiti della parola più vicina. Se, ad esempio, la stringa riconosciuta è "I am late", questo metodo viene chiamato utilizzando il valore di parametro 6 per start e 1 per length(corrispondente alla lettera "a" in "late"). Il metodo restituisce un insieme costituito da un singolo oggetto ContextNode, ovvero InkWordNode o TextWordNode. In questo esempio il metodo imposta inoltre il valore di start su 5 e il valore di length su 4, che corrisponde alla parola "late".

Esempi

In questo esempio viene reimpostata la proprietà Text di un oggetto TextBox denominato theResultsTextBox, dal valore restituito da GetRecognizedString() per InkAnalyzer (theInkAnalyzer), ai nuovi valori nella selezione della casella di testo che contrassegnano l'oggetto Strokes corrispondente alla selezione della casella di testo.

' 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)

' 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
For Each theContextNode As ContextNode 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);

// 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;
    }
}

Piattaforme

Windows Vista

.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.

Informazioni sulla versione

.NET Framework

Supportato in: 3.0

Vedere anche

Riferimenti

InkAnalyzer Classe

Membri InkAnalyzer

Overload GetNodesFromTextRange

Spazio dei nomi System.Windows.Ink