Condividi tramite


Evento Strokes.StrokesRemoved

Aggiornamento: novembre 2007

Si verifica quando uno o più oggetti Stroke vengono eliminati dall'insieme Strokes.

Spazio dei nomi:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Sintassi

'Dichiarazione
Public Event StrokesRemoved As StrokesEventHandler
'Utilizzo
Dim instance As Strokes
Dim handler As StrokesEventHandler

AddHandler instance.StrokesRemoved, handler
public event StrokesEventHandler StrokesRemoved
public:
 event StrokesEventHandler^ StrokesRemoved {
    void add (StrokesEventHandler^ value);
    void remove (StrokesEventHandler^ value);
}
/** @event */
public void add_StrokesRemoved (StrokesEventHandler value)
/** @event */
public void remove_StrokesRemoved (StrokesEventHandler value)
JScript non supporta gli eventi.

Note

Il gestore eventi riceve un argomento di tipo StrokesEventArgs contenente i dati relativi a questo evento.

Quando si crea un delegato StrokesEventHandler, si identifica il metodo che gestisce l'evento. Per associare l'evento al gestore in uso, aggiungere all'evento un'istanza del delegato. Il gestore eventi viene chiamato ogni volta che si verifica l'evento, a meno che non si rimuova il delegato.

Esempi

In questo esempio, un gestore eventi StrokesRemoved salva gli oggetti Stroke rimossi in un insieme Strokes personalizzato.

' Reminder: To avoid a memory leak, you must explicitly call the Dispose() method 
' on any Strokes collection to which an event handler has been attached before 
' the collection goes out of scope. 
Private Sub Strokes_StrokesRemoved(ByVal sender As Object, ByVal e As StrokesEventArgs)
    Try
        ' get the Ink object associated with the 
        ' Strokes collection that fired this event
        Dim mInk As Ink = DirectCast(sender, Strokes).Ink
        ' get the CustomStrokes collection named "REMOVED"
        Dim removed As Strokes = mInk.CustomStrokes("REMOVED")
        ' add the removed Strokes to the custom collection
        removed.Add(mInk.CreateStrokes(e.StrokeIds))

    Catch Ex As ArgumentException
        ' this exception is raised if the named collection ("REMOVED") does not exist
    End Try
End Sub
// Reminder: To avoid a memory leak, you must explicitly call the Dispose() method 
// on any Strokes collection to which an event handler has been attached before 
// the collection goes out of scope. 
private void Strokes_StrokesRemoved(object sender, StrokesEventArgs e)
{
    try
    {
        // get the Ink object associated with the 
        // Strokes collection that fired this event
        Ink mInk = ((Strokes)sender).Ink;
        // get the CustomStrokes collection named "REMOVED"
        Strokes removed = mInk.CustomStrokes["REMOVED"];
        // add the removed Strokes to the custom collection
        removed.Add(mInk.CreateStrokes(e.StrokeIds));
    }
    catch (ArgumentException)
    {
        // this exception is raised if the named collection ("REMOVED") does not exist
    }
}

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

Strokes Classe

Membri Strokes

Spazio dei nomi Microsoft.Ink

Ink

Strokes.Remove