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
Trova l'intervallo di testo nella stringa riconosciuta che corrisponde a un insieme di oggetti ContextNode discendenti di RootNode.
Spazio dei nomi: System.Windows.Ink
Assembly: IAWinFX (in IAWinFX.dll)
Sintassi
'Dichiarazione
Public Sub GetTextRangeFromNodes ( _
subTree As ContextNodeCollection, _
<OutAttribute> ByRef start As Integer, _
<OutAttribute> ByRef length As Integer _
)
'Utilizzo
Dim instance As RootNode
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
- subTree
Tipo: System.Windows.Ink.ContextNodeCollection
Insieme di oggetti ContextNode discendenti di RootNode.
- 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 RootNode, 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 RootNode, theRootNode, di un oggetto InkAnalyzer denominato theInkAnalyzer e viene trovato l'ultimo oggetto WritingRegionNode selezionando l'area di scrittura con i limiti più bassi. Quindi, viene individuato l'intervallo di testo che corrisponde all'area di scrittura corrente, viene inserito il valore di GetRecognizedString in un oggetto TextBox denominato theResultsTextBox e viene selezionato il testo che corrisponde all'ultima area di scrittura.
Dim theRootNode As RootNode = CType(theInkAnalyzer.RootNode, RootNode)
Dim regions As ContextNodeCollection = theInkAnalyzer.FindNodesOfType(ContextNodeType.WritingRegion)
Dim lastRegion As WritingRegionNode = Nothing
Dim maxY As Double = Double.MinValue
Dim region As WritingRegionNode
For Each region In regions
If [region].Location.GetBounds().Bottom > maxY Then
maxY = [region].Location.GetBounds().Bottom
lastRegion = [region]
End If
Next region
If lastRegion Is Nothing Then
Return
End If
' Create a collection to hold this line
Dim lastRegionCollection As New ContextNodeCollection(theInkAnalyzer)
lastRegionCollection.Add(lastRegion)
' Find corresponding start and length
Dim start, length As Integer
theRootNode.GetTextRangeFromNodes(lastRegionCollection, start, length)
' Select this in the text box
theResultsTextBox.Text = theRootNode.GetRecognizedString()
theResultsTextBox.Select(start, length)
RootNode theRootNode = (RootNode)theInkAnalyzer.RootNode;
ContextNodeCollection regions =
theInkAnalyzer.FindNodesOfType(ContextNodeType.WritingRegion);
WritingRegionNode lastRegion = null;
double maxY = double.MinValue;
foreach (WritingRegionNode region in regions)
{
if (region.Location.GetBounds().Bottom > maxY)
{
maxY = region.Location.GetBounds().Bottom;
lastRegion = region;
}
}
if (lastRegion == null)
return;
// Create a collection to hold this line
ContextNodeCollection lastRegionCollection =
new ContextNodeCollection(theInkAnalyzer);
lastRegionCollection.Add(lastRegion);
// Find corresponding start and length
int start, length;
theRootNode.GetTextRangeFromNodes(lastRegionCollection, out start, out length);
// Select this in the text box
theResultsTextBox.Text = theRootNode.GetRecognizedString();
theResultsTextBox.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