Condividi tramite


Metodo InkAnalyzer.AddStrokes (StrokeCollection)

Aggiornamento: novembre 2007

Aggiunge l'oggetto StrokeCollection specificato a InkAnalyzer e assegna a ogni tratto l'identificatore delle impostazioni locali del thread di input attivo.

Spazio dei nomi:  System.Windows.Ink
Assembly:  IAWinFX (in IAWinFX.dll)

Sintassi

'Dichiarazione
Public Function AddStrokes ( _
    strokesToAdd As StrokeCollection _
) As ContextNode
'Utilizzo
Dim instance As InkAnalyzer
Dim strokesToAdd As StrokeCollection
Dim returnValue As ContextNode

returnValue = instance.AddStrokes(strokesToAdd)
public ContextNode AddStrokes(
    StrokeCollection strokesToAdd
)
public:
ContextNode^ AddStrokes(
    StrokeCollection^ strokesToAdd
)
public ContextNode AddStrokes(
    StrokeCollection strokesToAdd
)
public function AddStrokes(
    strokesToAdd : StrokeCollection
) : ContextNode

Parametri

Valore restituito

Tipo: System.Windows.Ink.ContextNode
Oggetto ContextNode a cui viene 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 un identificatore delle impostazioni locali per il thread di input attivo. Ogni tratto dell'insieme viene anche 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

InkAnalyzer Classe

Membri InkAnalyzer

Overload AddStrokes

Spazio dei nomi System.Windows.Ink

InkAnalyzer.AddStroke

InkAnalyzerRemoveStroke()

InkAnalyzerRemoveStrokes()