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 rilevanti per l'intervallo di testo specificato.
Spazio dei nomi: Microsoft.Ink
Assembly: Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.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
- start
Tipo: System.Int32%
Riferimento all'inizio dell'intervallo di testo nella stringa riconosciuta.
- length
Tipo: System.Int32%
Riferimento alla lunghezza dell'intervallo di testo nella stringa riconosciuta.
Valore restituito
Tipo: Microsoft.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" e si chiama questo metodo utilizzando il valore di parametro 6 per start e 1 per length, che corrisponde alla lettera "a" in "late", questo metodo restituisce un insieme contenente un singolo oggetto ContextNode, l'oggetto InkWordNode o TextWordNode che corrisponde alla parola "late". In questo esempio questo 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 utilizzato un oggetto System.Windows.Forms.TextBox, theResultsTextBox, la cui proprietà Text è stata impostata precedentemente sul valore restituito da GetRecognizedString per l'oggetto InkAnalyzer, theInkAnalyzer. Nel codice di esempio viene utilizzata la selezione della casella di testo e contrassegnato l'oggetto Strokes che corrisponde a tale selezione.
' 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 Microsoft.Ink.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
Dim theStroke As Microsoft.Ink.Stroke
For Each theStroke In Me.theInkAnalyzer.RootNode.Strokes
theStroke.DrawingAttributes = _
New Microsoft.Ink.DrawingAttributes(Color.Black)
Next theStroke
' Next, set all selected sub nodes to red
Dim theContextNode As Microsoft.Ink.ContextNode
For Each theContextNode In selectedSubNodes
For Each theStroke In theContextNode.Strokes
theStroke.DrawingAttributes = _
New Microsoft.Ink.DrawingAttributes(Color.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
Microsoft.Ink.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 (Microsoft.Ink.Stroke theStroke
in this.theInkAnalyzer.RootNode.Strokes)
{
theStroke.DrawingAttributes =
new Microsoft.Ink.DrawingAttributes(Color.Black);
}
// Next, set all selected sub nodes to red
foreach (Microsoft.Ink.ContextNode theContextNode in selectedSubNodes)
{
foreach (Microsoft.Ink.Stroke theStroke in theContextNode.Strokes)
{
theStroke.DrawingAttributes =
new Microsoft.Ink.DrawingAttributes(Color.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