Condividi tramite


Metodo RootNode.GetNodesFromTextRange (Int32%, Int32%, ContextNodeCollection)

Aggiornamento: novembre 2007

Restituisce un insieme di oggetti ContextNode discendenti rilevanti per l'intervallo di testo specificato nella stringa riconosciuta per un insieme di nodi discendenti.

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

Sintassi

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

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

Parametri

Valore restituito

Tipo: System.Windows.Ink.ContextNodeCollection
Insieme di oggetti ContextNode discendenti corrispondenti all'intervallo di testo specificato nella stringa riconosciuta all'interno dell'insieme di nodi discendenti.

Note

I parametri start e length sono valori di riferimento che possono essere modificati per specificare la stringa intera associata all'oggetto ContextNodeCollection restituito. Ad esempio, se il valore restituito di GetRecognizedString è "I am late" e si passano i valori di start = 6 e length = 1, questi parametri corrispondono alla lettera "a". È quindi probabile che ContextNodeCollection contenga un solo oggetto ContextNode, l'oggetto InkWordNode che corrisponde alla parola "late". In questo esempio, il valore di start viene modificato in 5 e il valore di length viene modificato in 4, per corrispondere all'intera parola "late".

Nota

Il parametro start è relativo ai nodi nel parametro subTree. Nell'esempio precedente, se si passa un parametro subTree con nodi per "am" e "late", ma non per "I", un parametro start di 3 e una lunghezza di 4 rappresentano l'intervallo di testo per la parola "late".

Esempi

Nell'esempio seguente viene utilizzato il metodo GetNodesFromTextRange per contrassegnare i tratti che corrispondono al testo selezionato. Nel codice di esempio si presuppone che la proprietà Text dell'oggetto TextBox denominato theResultsTextBox sia impostata sul valore restituito dal metodo GetRecognizedString. Inoltre, si presuppone che l'utente abbia selezionato un testo nell'oggetto theResultsTextBox e che sia disponibile un oggetto InkAnalyzer denominato theInkAnalyzer.

    ' Get the nodes that correspond to this start and length
    Dim selectedNodes As ContextNodeCollection = _
        theRootNode.GetNodesFromTextRange(start, length, lastRegionCollection)

    ' Set all strokes to black
    For Each stroke As Stroke In theRootNode.Strokes
        stroke.DrawingAttributes.Color = Colors.Black
    Next stroke
    ' Set strokes in the collection to red
    For Each node As ContextNode In selectedNodes
        For Each stroke As Stroke In node.Strokes
            stroke.DrawingAttributes.Color = Colors.Red
        Next stroke
    Next node

End Sub 'showLastWritingRegion_Click
// Get the nodes that correspond to this start and length
ContextNodeCollection selectedNodes =
    theRootNode.GetNodesFromTextRange(ref start, ref length, lastRegionCollection);

// Set all strokes to black
foreach (Stroke stroke in theRootNode.Strokes)
    stroke.DrawingAttributes.Color = Colors.Black;

// Set strokes in the collection to red
foreach (ContextNode node in selectedNodes)
{
    foreach (Stroke stroke in node.Strokes)
    {
        stroke.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

RootNode Classe

Membri RootNode

Overload GetNodesFromTextRange

Spazio dei nomi System.Windows.Ink