Share via


InkPicture.SelectionMoving (Evento)

Actualización: noviembre 2007

Se produce cuando el tamaño de la selección actual está a punto de cambiar, por ejemplo por alteraciones de la interfaz de usuario, procedimientos de cortar y pegar o la propiedad Selection.

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

Sintaxis

'Declaración
Public Event SelectionMoving As InkOverlaySelectionMovingEventHandler
'Uso
Dim instance As InkPicture
Dim handler As InkOverlaySelectionMovingEventHandler

AddHandler instance.SelectionMoving, handler
public event InkOverlaySelectionMovingEventHandler SelectionMoving
public:
 event InkOverlaySelectionMovingEventHandler^ SelectionMoving {
    void add (InkOverlaySelectionMovingEventHandler^ value);
    void remove (InkOverlaySelectionMovingEventHandler^ value);
}
/** @event */
public void add_SelectionMoving (InkOverlaySelectionMovingEventHandler value)
/** @event */
public void remove_SelectionMoving (InkOverlaySelectionMovingEventHandler value)
JScript no admite eventos.

Comentarios

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

Al crear un delegado de InkOverlaySelectionMovingEventHandler, 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 a su controlador, a menos que se quite el delegado. Para mejorar el rendimiento, el interés del evento predeterminado está desactivado, pero se activa automáticamente si se agrega un controlador de eventos.

Ejemplos

En este ejemplo, un controlador de eventos SelectionMoving examina una selección antes de moverla. Si la selección va a moverse y una parte va a quedar fuera de los límites de la ventana, el controlador de eventos establece la selección en rojo cambiando la propiedad Color de cada objeto Stroke seleccionado.

Private Sub mInkPicture_SelectionMoving(ByVal sender As Object, ByVal e As InkOverlaySelectionMovingEventArgs)
    If e.NewPixelRect.Left < 0 Or e.NewPixelRect.Top < 0 Or _
       e.NewPixelRect.Right > mInkPicture.ClientRectangle.Width Or _
        e.NewPixelRect.Bottom > mInkPicture.ClientRectangle.Height Then

        For Each stroke As Stroke In mInkPicture.Selection
            ' change the stroke color
            stroke.DrawingAttributes.Color = Color.Red
        Next

    End If
End Sub
private void mInkPicture_SelectionMoving(object sender, InkOverlaySelectionMovingEventArgs e)
{
    if (e.NewPixelRect.Left < 0 || e.NewPixelRect.Top < 0 ||
        e.NewPixelRect.Right > mInkPicture.ClientRectangle.Width ||
        e.NewPixelRect.Bottom > mInkPicture.ClientRectangle.Height)
    {
        foreach (Stroke stroke in mInkObject.Selection)
        {
            // change the stroke color
            stroke.DrawingAttributes.Color = Color.Red;
        }
    }
}

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)

InkOverlaySelectionMovedEventArgs

InkPicture.Selection

InkPicture.SelectionMoved