InkAnalyzer.GetTextRangeFromNodes (Método)
Actualización: noviembre 2007
Busca el intervalo de texto en la cadena reconocida que corresponde a una colección de objetos ContextNode.
Espacio de nombres: Microsoft.Ink
Ensamblado: Microsoft.Ink.Analysis (en Microsoft.Ink.Analysis.dll)
Sintaxis
'Declaración
Public Sub GetTextRangeFromNodes ( _
nodesToSearch As ContextNodeCollection, _
<OutAttribute> ByRef start As Integer, _
<OutAttribute> ByRef length As Integer _
)
'Uso
Dim instance As InkAnalyzer
Dim nodesToSearch As ContextNodeCollection
Dim start As Integer
Dim length As Integer
instance.GetTextRangeFromNodes(nodesToSearch, _
start, length)
public void GetTextRangeFromNodes(
ContextNodeCollection nodesToSearch,
out int start,
out int length
)
public:
void GetTextRangeFromNodes(
ContextNodeCollection^ nodesToSearch,
[OutAttribute] int% start,
[OutAttribute] int% length
)
public void GetTextRangeFromNodes(
ContextNodeCollection nodesToSearch,
/** @attribute OutAttribute */ /** @ref */int start,
/** @attribute OutAttribute */ /** @ref */int length
)
public function GetTextRangeFromNodes(
nodesToSearch : ContextNodeCollection,
start : int,
length : int
)
Parámetros
- nodesToSearch
Tipo: Microsoft.Ink.ContextNodeCollection
La colección de objetos ContextNode para los que se busca el intervalo de texto.
- start
Tipo: System.Int32%
Cuando este método finaliza, el parámetro start contiene un entero de 32 bits con signo que indica el comienzo del intervalo de texto. Este parámetro se pasa sin inicializar.
- length
Tipo: System.Int32%
Cuando este método finaliza, el parámetro length contiene un entero de 32 bits con signo que indica la longitud del intervalo de texto. Este parámetro se pasa sin inicializar.
Comentarios
Si nodesToSearch contiene objetos ContextNode que no son adyacentes, este método devuelve el intervalo de texto más pequeño que cubre todos los objetos ContextNode.
Este método genera una excepción System.ArgumentException cuando nodesToSearch contiene un objeto ContextNode que no está asociado al objeto InkAnalyzer.
Ejemplos
En este ejemplo se define un método, SelectTextRangeFromNodes que establece el texto de System.Windows.Forms.TextBoxtheResultsTextBox, en la cadena de reconocimiento del objeto InkAnalyzer, theInkAnalyzer. A continuación, establece la selección del cuadro de texto para que abarque el texto reconocido del parámetro, theContextNodes.
''' <summary>
''' Selects the text range in the TextBox, theResultsTextBox, that represents
''' the node ranges in theContextNodes.
''' </summary>
''' <param name="theContextNodes">
''' The nodes for which to select the text range.</param>
''' <remarks>
''' If <paramref name="theContextNodes"/> are not current context nodes
''' of the InkAnalyzer, theInkAnalyzer, then GetTextRangeFromNodes throws
''' an ArgumentException.
''' </remarks>
Private Sub SelectTextRangeFromNodes(ByVal theContextNodes As Microsoft.Ink.ContextNodeCollection)
' Set the text of theResultsTextBox.
Me.theResultsTextBox.Text = Me.theInkAnalyzer.GetRecognizedString()
' Get the text range for theContextNodes.
Dim theStart As Integer
Dim theLength As Integer
Try
Me.theInkAnalyzer.GetTextRangeFromNodes( _
theContextNodes, theStart, theLength)
' Check for common exceptions.
Catch ex As ArgumentException
Throw New ArgumentException( _
"Invalid ContextNodeCollection", "theContextNodes", ex)
End Try
' Select the text range in the TextBox.
Me.theResultsTextBox.Select(theStart, theLength)
Me.theResultsTextBox.Invalidate()
End Sub 'SelectTextRangeFromNodes
/// <summary>
/// Selects the text range in the TextBox, theResultsTextBox, that represents
/// the node ranges in theContextNodes.
/// </summary>
/// <param name="theContextNodes">
/// The nodes for which to select the text range.</param>
/// <remarks>
/// If <paramref name="theContextNodes"/> are not current context nodes
/// of the InkAnalyzer, theInkAnalyzer, then GetTextRangeFromNodes throws
/// an ArgumentException.
/// </remarks>
private void SelectTextRangeFromNodes(
Microsoft.Ink.ContextNodeCollection theContextNodes)
{
// Set the text of theResultsTextBox.
this.theResultsTextBox.Text = this.theInkAnalyzer.GetRecognizedString();
// Get the text range for theContextNodes.
int theStart;
int theLength;
try
{
this.theInkAnalyzer.GetTextRangeFromNodes(
theContextNodes, out theStart, out theLength);
}
// Check for common exceptions.
catch (ArgumentException ex)
{
throw new ArgumentException("Invalid ContextNodeCollection",
"theContextNodes", ex);
}
// Select the text range in the TextBox.
this.theResultsTextBox.Select(theStart, theLength);
this.theResultsTextBox.Invalidate();
}
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