Metodo InkAnalyzer.AddStrokes (StrokeCollection, Int32)
Aggiornamento: novembre 2007
Aggiunge un oggetto StrokeCollection all'oggetto InkAnalyzer e assegna a ogni tratto uno specifico identificatore delle impostazioni locali.
Spazio dei nomi: System.Windows.Ink
Assembly: IAWinFX (in IAWinFX.dll)
Sintassi
'Dichiarazione
Public Function AddStrokes ( _
strokesToAdd As StrokeCollection, _
languageId As Integer _
) As ContextNode
'Utilizzo
Dim instance As InkAnalyzer
Dim strokesToAdd As StrokeCollection
Dim languageId As Integer
Dim returnValue As ContextNode
returnValue = instance.AddStrokes(strokesToAdd, _
languageId)
public ContextNode AddStrokes(
StrokeCollection strokesToAdd,
int languageId
)
public:
ContextNode^ AddStrokes(
StrokeCollection^ strokesToAdd,
int languageId
)
public ContextNode AddStrokes(
StrokeCollection strokesToAdd,
int languageId
)
public function AddStrokes(
strokesToAdd : StrokeCollection,
languageId : int
) : ContextNode
Parametri
- strokesToAdd
Tipo: System.Windows.Ink.StrokeCollection
Oggetto StrokeCollection da aggiungere a InkAnalyzer.
- languageId
Tipo: System.Int32
Identificatore delle impostazioni locali assegnato ai tratti dell'insieme strokesToAdd.
Valore restituito
Tipo: System.Windows.Ink.ContextNode
Oggetto ContextNode in cui è stato aggiunto l'oggetto strokesToAdd.
Note
InkAnalyzer aggiunge l'oggetto StrokeCollection a un oggetto UnclassifiedInkNode nell'insieme SubNodes della proprietà RootNode. A ogni tratto dell'insieme StrokeCollection, strokesToAdd, viene assegnato l'identificatore delle impostazioni locali languageId. Quindi il tratto viene aggiunto al primo oggetto UnclassifiedInkNode contenente i tratti con lo stesso identificatore delle impostazioni locali. Se non esiste alcun oggetto UnclassifiedInkNode, viene creato un nuovo oggetto UnclassifiedInkNode e strokesToAdd viene aggiunto al nuovo oggetto UnclassifiedInkNode.
Questo metodo espande l'oggetto DirtyRegion all'unione del valore corrente dell'area e del riquadro dei tratti aggiunti.
Se un tratto è già associato all'oggetto InkAnalyzer, InkAnalyzer genera un'eccezione.
Esempi
Nell'esempio seguente viene creato un nuovo oggetto InkAnalyzer e il gestore per l'evento StrokesChanged viene associato alla proprietà Strokes nell'oggetto InkCanvas denominato theInkCanvas.
theInkAnalyzer = New InkAnalyzer()
AddHandler theInkCanvas.Strokes.StrokesChanged, AddressOf Strokes_StrokesChanged
theInkAnalyzer = new InkAnalyzer();
theInkCanvas.Strokes.StrokesChanged +=
new StrokeCollectionChangedEventHandler(Strokes_StrokesChanged);
Nell'esempio seguente viene definito il gestore eventi Strokes_StrokesChanged che aggiunge i tratti a theInkAnalyzer, se erano già stati aggiunti a theInkCanvas. Quindi, i tratti vengono rimossi da theInkAnalyzer, se erano già stati rimossi da theInkCanvas.
' This event occurs whenever a stroke is added, removed, or partially erased
' from the InkCanvas.
Sub Strokes_StrokesChanged(ByVal sender As Object, ByVal e As StrokeCollectionChangedEventArgs)
If e.Added.Count > 0 Then
theInkAnalyzer.AddStrokes(e.Added)
End If
If e.Removed.Count > 0 Then
theInkAnalyzer.RemoveStrokes(e.Removed)
End If
End Sub 'Strokes_StrokesChanged
// This event occurs whenever a stroke is added, removed, or partially erased
// from the InkCanvas.
void Strokes_StrokesChanged(object sender, StrokeCollectionChangedEventArgs e)
{
if (e.Added.Count > 0)
{
theInkAnalyzer.AddStrokes(e.Added);
}
if (e.Removed.Count > 0)
{
theInkAnalyzer.RemoveStrokes(e.Removed);
}
}
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
Spazio dei nomi System.Windows.Ink
InkAnalyzerRemoveStroke()
InkAnalyzerRemoveStrokes()