Compartir a través de


LineNode.GetTextRangeFromNodes (Método)

Actualización: noviembre 2007

Busca el intervalo de texto en la cadena reconocida que se corresponde con una colección de objetos ContextNode que son descendientes de LineNode.

Espacio de nombres:  Microsoft.Ink
Ensamblado:  Microsoft.Ink.Analysis (en Microsoft.Ink.Analysis.dll)

Sintaxis

'Declaración
Public Sub GetTextRangeFromNodes ( _
    subTree As ContextNodeCollection, _
    <OutAttribute> ByRef start As Integer, _
    <OutAttribute> ByRef length As Integer _
)
'Uso
Dim instance As LineNode
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
)

Parámetros

  • start
    Tipo: System.Int32%
    Comienzo del intervalo de texto.
  • length
    Tipo: System.Int32%
    Longitud del intervalo de texto.

Comentarios

Si subTree contiene un objeto ContextNode que no es ningún descendiente de LineNode, se produce una excepción ArgumentException.

Si subTree contiene objetos ContextNode que no son consecutivos, se devuelve el intervalo de texto más pequeño que cubre todos los objetos ContextNode.

Ejemplos

En el ejemplo siguiente, se toma InkWordNode, inkWord, y se comprueba si su ParentNode es LineNode. Si lo es, se coloca el valor de GetRecognizedString en un TextBox, selectedResultsTextBox, y se selecciona el texto que corresponde a inkWord.

Dim parentNode As ContextNode = inkWord.ParentNode
If TypeOf parentNode Is LineNode Then
    Dim parentLine As LineNode = CType(parentNode, LineNode)
    ' Put parent line's recognized string into the text box
    selectedResultsTextBox.Text = parentLine.GetRecognizedString()

    ' Select the text that corresponds to the ink word
    Dim subNodes As New ContextNodeCollection(theInkAnalyzer)
    subNodes.Add(inkWord)
    Dim start As Integer
    Dim length As Integer
    parentLine.GetTextRangeFromNodes(subNodes, start, length)
    If start >= 0 AndAlso length > 0 Then
        selectedResultsTextBox.Select(start, length)
    End If
End If
                    ContextNode parentNode = inkWord.ParentNode;
                    if (parentNode is LineNode)
                    {
                        LineNode parentLine = (LineNode)parentNode;
                        // Put parent line's recognized string into the text box
                        selectedResultsTextBox.Text = parentLine.GetRecognizedString();

                        // Select the text that corresponds to the ink word
                        ContextNodeCollection subNodes = new ContextNodeCollection(theInkAnalyzer);
                        subNodes.Add(inkWord);
                        int start = 0;
                        int length = 0;
                        parentLine.GetTextRangeFromNodes(subNodes, out start, out length);
                        if (start >= 0 && length > 0)
                        {
                            selectedResultsTextBox.Select(start, length);
                        }
                    }

Plataformas

Windows Vista

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Información de versión

.NET Framework

Compatible con: 3.0

Vea también

Referencia

LineNode (Clase)

LineNode (Miembros)

Microsoft.Ink (Espacio de nombres)