Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
Aggiornamento: novembre 2007
Restituisce un insieme di oggetti ContextNode discendenti relativi all'intervallo di testo specificato nella stringa riconosciuta.
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 RootNode
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
- start
Tipo: System.Int32%
- length
Tipo: System.Int32%
Valore restituito
Tipo: System.Windows.Ink.ContextNodeCollection
Insieme di oggetti ContextNode discendenti rilevanti per l'intervallo di testo specificato nella stringa riconosciuta.
Note
I parametri start e length sono valori di riferimento che possono essere modificati per specificare una 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, i 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".
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 e che l'utente abbia selezionato un testo nell'oggetto theResultsTextBox. Inoltre, si presuppone che sia disponibile un oggetto InkAnalyzer denominato theInkAnalyzer.
Dim theRootNode As RootNode = CType(theInkAnalyzer.RootNode, RootNode)
' First, set all strokes to black
For Each stroke As Stroke In theRootNode.Strokes
stroke.DrawingAttributes.Color = Colors.Black
Next stroke
' Find out what's been selected in the text box
Dim selStart As Integer = theResultsTextBox.SelectionStart
Dim selLength As Integer = theResultsTextBox.SelectionLength
' Do nothing if no text is selected.
If selLength = 0 Then
Return
End If
' Get the nodes that correspond to that range
Dim selectedSubNodes As ContextNodeCollection = _
theRootNode.GetNodesFromTextRange(selStart, selLength)
' Use the new start and length value to update the
' selection in the TextBox
theResultsTextBox.SelectionStart = selStart
theResultsTextBox.SelectionLength = selLength
' Next, set all selected sub nodes to red
Dim node As ContextNode
For Each node In selectedSubNodes
Dim stroke As Stroke
For Each stroke In node.Strokes
stroke.DrawingAttributes.Color = Colors.Red
Next stroke
Next node
RootNode theRootNode = (RootNode)theInkAnalyzer.RootNode;
// First, set all strokes to black
foreach (Stroke stroke in theRootNode.Strokes)
stroke.DrawingAttributes.Color = Colors.Black;
// Find out what's been selected in the text box
int selStart = theResultsTextBox.SelectionStart;
int selLength = theResultsTextBox.SelectionLength;
// Do nothing if no text is selected.
if (selLength == 0)
{
return;
}
// Get the nodes that correspond to that range
ContextNodeCollection selectedSubNodes =
theRootNode.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;
// Next, set all selected sub nodes to red
foreach (ContextNode node in selectedSubNodes)
{
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