Share via


Strokes.StrokesRemoved (Evento)

Actualización: noviembre 2007

Se produce cuando se eliminan uno o más objetos Stroke de la colección Strokes.

Espacio de nombres:  Microsoft.Ink
Ensamblado:  Microsoft.Ink (en Microsoft.Ink.dll)

Sintaxis

'Declaración
Public Event StrokesRemoved As StrokesEventHandler
'Uso
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 no admite eventos.

Comentarios

El controlador de eventos recibe un argumento de tipo StrokesEventArgs que contiene datos sobre este evento.

Cuando se crea un delegado de StrokesEventHandler, se identifica el método que controla el evento. Para asociarlo al controlador de eventos, se debe agregar al evento una instancia del delegado. Siempre que se produce el evento se llama al controlador de eventos, a menos que se quite el delegado.

Ejemplos

En este ejemplo, un controlador de eventos StrokesRemoved guarda los objetos Stroke quitados en una colección Strokes personalizada.

' 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
    }
}

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

Vea también

Referencia

Strokes (Clase)

Strokes (Miembros)

Microsoft.Ink (Espacio de nombres)

Ink

Strokes.Remove