Condividi tramite


Metodo ParagraphNode.GetTextRangeFromNodes

Aggiornamento: novembre 2007

Trova l'intervallo di testo nella stringa riconosciuta che corrisponde a un insieme di oggetti ContextNode discendenti dell'oggetto ParagraphNode.

Spazio dei nomi:  Microsoft.Ink
Assembly:  Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)

Sintassi

'Dichiarazione
Public Sub GetTextRangeFromNodes ( _
    subTree As ContextNodeCollection, _
    <OutAttribute> ByRef start As Integer, _
    <OutAttribute> ByRef length As Integer _
)
'Utilizzo
Dim instance As ParagraphNode
Dim subTree As ContextNodeCollection
Dim start As Integer
Dim length As Integer

instance.GetTextRangeFromNodes(subTree, _
    start, length)
public void GetTextRangeFromNodes(
    ContextNodeCollection subTree,
    out int start,
    out int length
)
public:
void GetTextRangeFromNodes(
    ContextNodeCollection^ subTree, 
    [OutAttribute] int% start, 
    [OutAttribute] int% length
)
public void GetTextRangeFromNodes(
    ContextNodeCollection subTree,
    /** @attribute OutAttribute */ /** @ref */int start,
    /** @attribute OutAttribute */ /** @ref */int length
)
public function GetTextRangeFromNodes(
    subTree : ContextNodeCollection, 
    start : int, 
    length : int
)

Parametri

  • start
    Tipo: System.Int32%
    Inizio dell'intervallo di testo.
  • length
    Tipo: System.Int32%
    Lunghezza dell'intervallo di testo.

Note

Se il parametro subTree contiene un oggetto ContextNode che non è un discendente di ParagraphNode, viene generata un'eccezione ArgumentException.

Se il parametro subTree contiene oggetti ContextNode non consecutivi, viene restituito l'intervallo di testo più piccolo in cui rientrano tutti gli oggetti ContextNode.

Esempi

Nell'esempio seguente viene utilizzato un oggetto ParagraphNode, paragraph e trovata l'ultima riga. Successivamente, viene individuato l'intervallo di testo che corrisponde a questa riga, viene inserito il valore GetRecognizedString in un oggetto TextBox, selectedResultsTextBox e viene selezionato il testo che corrisponde all'ultima riga.

Dim nLines As Integer = paragraph.SubNodes.Count
Dim lastLine As LineNode = CType(paragraph.SubNodes(nLines - 1), LineNode)

' Create a collection to hold this line
Dim lastLineCollection As New ContextNodeCollection(theInkAnalyzer)
lastLineCollection.Add(lastLine)

' Find corresponding start and length
Dim start, length As Integer
paragraph.GetTextRangeFromNodes(lastLineCollection, start, length)

' Select this in the text box
selectedResultsTextBox.Text = paragraph.GetRecognizedString()
selectedResultsTextBox.Select(start, length)
                int nLines = paragraph.SubNodes.Count;
                LineNode lastLine = (LineNode)paragraph.SubNodes[nLines - 1];

                // Create a collection to hold this line
                ContextNodeCollection lastLineCollection = new ContextNodeCollection(theInkAnalyzer);
                lastLineCollection.Add(lastLine);

                // Find corresponding start and length
                int start, length;
                paragraph.GetTextRangeFromNodes(lastLineCollection, out start, out length);

                // Select this in the text box
                selectedResultsTextBox.Text = paragraph.GetRecognizedString();
                selectedResultsTextBox.Select(start, length);

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

ParagraphNode Classe

Membri ParagraphNode

Spazio dei nomi Microsoft.Ink