Compartir a través de


InkPicture.StrokesDeleted (Evento)

Actualización: noviembre 2007

Se produce una vez eliminados los objetos Stroke de la propiedad Ink del control InkPicture.

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

Sintaxis

'Declaración
Public Event StrokesDeleted As InkOverlayStrokesDeletedEventHandler
'Uso
Dim instance As InkPicture
Dim handler As InkOverlayStrokesDeletedEventHandler

AddHandler instance.StrokesDeleted, handler
public event InkOverlayStrokesDeletedEventHandler StrokesDeleted
public:
 event InkOverlayStrokesDeletedEventHandler^ StrokesDeleted {
    void add (InkOverlayStrokesDeletedEventHandler^ value);
    void remove (InkOverlayStrokesDeletedEventHandler^ value);
}
/** @event */
public void add_StrokesDeleted (InkOverlayStrokesDeletedEventHandler value)
/** @event */
public void remove_StrokesDeleted (InkOverlayStrokesDeletedEventHandler value)
JScript no admite eventos.

Comentarios

El controlador de eventos recibe un argumento de tipo EventArgs que no contiene datos.

Ejemplos

En este ejemplo se muestra cómo se puede suscribir a los eventos Stoke() y StrokesDeleted para modificar el color de fondo del control InkPicture.

Cuando se desencadena el evento Stoke(), se examina la propiedad EditingMode. Si actualmente se encuentra en el modo de entrada manuscrita, el color de fondo del control cambiará a blanco. Debe comprobar la propiedad EditingMode porque el evento Stoke() también se desencadena al borrar trazos.

Private Sub mInkPicture_Stroke3(ByVal sender As Object, ByVal e As InkCollectorStrokeEventArgs)
    ' If you are in inking mode, change background to white.
    ' (This event will also fire in Delete mode because the movement made by
    ' the eraser is considered a stroke.)
    If (InkOverlayEditingMode.Ink = mInkPicture.EditingMode) Then
        mInkPicture.BackColor = Color.White
    End If
End Sub
private void mInkPicture_Stroke3(object sender, InkCollectorStrokeEventArgs e)
{
    // If you are in inking mode, change background to white.
    // (This event will also fire in Delete mode because the movement made by
    // the eraser is considered a stroke.)
    if (InkOverlayEditingMode.Ink == mInkPicture.EditingMode)
    {
        mInkPicture.BackColor = Color.White;
    }
}

Cuando se desencadena el evento StrokesDeleted, se examina la colección Stokes(). Si no hay ningún objeto Stroke en la colección (o sólo queda el trazo del borrador), el color de fondo del control cambiará al color gris.

Private Sub mInkPicture_StrokesDeleted(ByVal sender As Object, ByVal e As EventArgs)
    ' Change the background to gray if there are no strokes.
    ' If the last stroke was deleted by an eraser, there will be one transparent 
    ' stroke, which is the stroke made by the eraser itself.
    If (mInkPicture.Ink.Strokes.Count = 0 Or _
       (mInkPicture.Ink.Strokes.Count = 1 And _
        mInkPicture.Ink.Strokes(0).DrawingAttributes.Transparency = 255)) Then

        mInkPicture.BackColor = Color.Gray

    End If
End Sub
private void mInkPicture_StrokesDeleted(object sender, EventArgs e)
{
    // Change the background to gray if there are no strokes.
    // If the last stroke was deleted by an eraser, there will be one transparent 
    // stroke, which is the stroke made by the eraser itself.
    if (mInkPicture.Ink.Strokes.Count == 0 ||
       (mInkPicture.Ink.Strokes.Count == 1 &&
        mInkPicture.Ink.Strokes[0].DrawingAttributes.Transparency == 255))
    {
        mInkPicture.BackColor = Color.Gray;
    }

}

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

InkPicture (Clase)

InkPicture (Miembros)

Microsoft.Ink (Espacio de nombres)

InkPicture.Ink

InkPicture.StrokesDeleting

System.EventArgs