Este tema aún no ha recibido ninguna valoración - Valorar este tema

QueryContinueDragEventArgs (Clase)

Actualización: noviembre 2007

Proporciona datos del evento QueryContinueDrag.

Espacio de nombres:  System.Windows.Forms
Ensamblado:  System.Windows.Forms (en System.Windows.Forms.dll)
[ComVisibleAttribute(true)]
public class QueryContinueDragEventArgs : EventArgs
/** @attribute ComVisibleAttribute(true) */
public class QueryContinueDragEventArgs extends EventArgs
public class QueryContinueDragEventArgs extends EventArgs

El evento QueryContinueDrag tiene lugar durante una operación de arrastrar y colocar y permite al origen de arrastre determinar si la operación de arrastrar y colocar tiene que cancelarse. QueryContinueDragEventArgs especifica si debe continuar la operación de arrastrar y colocar y cómo debe realizarse, si se han presionado teclas modificadoras y si el usuario ha presionado la tecla ESC.

De forma predeterminada, el evento QueryContinueDrag establece la propiedad Action en DragAction.Cancel si se presiona la tecla ESC, y establece Action en DragAction.Drop si se presiona el botón primario, secundario o central del mouse (ratón).

Para obtener información acerca del modelo de eventos, vea Eventos y delegados.

En este fragmento de código se muestra cómo se utiliza la clase QueryContinueDragEventArgs con el evento QueryContinueDrag. Para obtener el ejemplo de código completo, vea el método DoDragDrop.

private void ListDragSource_QueryContinueDrag(object sender, System.Windows.Forms.QueryContinueDragEventArgs e) {
    // Cancel the drag if the mouse moves off the form.
    ListBox lb = sender as ListBox;

    if (lb != null) {

        Form f = lb.FindForm();

        // Cancel the drag if the mouse moves off the form. The screenOffset
        // takes into account any desktop bands that may be at the top or left
        // side of the screen.
        if (((Control.MousePosition.X - screenOffset.X) < f.DesktopBounds.Left) ||
            ((Control.MousePosition.X - screenOffset.X) > f.DesktopBounds.Right) ||
            ((Control.MousePosition.Y - screenOffset.Y) < f.DesktopBounds.Top) ||
            ((Control.MousePosition.Y - screenOffset.Y) > f.DesktopBounds.Bottom)) {

            e.Action = DragAction.Cancel;
        }
    }
}


private void listDragSource_QueryContinueDrag(Object sender, 
    System.Windows.Forms.QueryContinueDragEventArgs e)
{
    // Cancel the drag if the mouse moves off the form.
    ListBox lb = (ListBox)sender;

    if (lb != null) {
        Form f = lb.FindForm();
        // Cancel the drag if the mouse moves off the form. The 
        // screenOffset takes into account any desktop bands 
        // that may be at the top or left side of the screen.
        if (Control.get_MousePosition().get_X() - screenOffset.get_X() 
            < f.get_DesktopBounds().get_Left() 
            || Control.get_MousePosition().get_X() 
            - screenOffset.get_X() > f.get_DesktopBounds().get_Right() 
            || Control.get_MousePosition().get_Y() - screenOffset.get_Y() 
            < f.get_DesktopBounds().get_Top() 
            || Control.get_MousePosition().get_Y() - screenOffset.get_Y() 
            > f.get_DesktopBounds().get_Bottom()) {
            e.set_Action(DragAction.Cancel);
        }
    }
} //listDragSource_QueryContinueDrag


System.Object
  System.EventArgs
    System.Windows.Forms.QueryContinueDragEventArgs
Todos los miembros static (Shared en Visual Basic) públicos de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.

Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

.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.

.NET Framework

Compatible con: 3.5, 3.0, 2.0, 1.1, 1.0
¿Le ha resultado útil?
(Caracteres restantes: 1500)
Contenido de la comunidad Agregar