QueryContinueDragEventArgs Clase

Definición

Proporciona datos para el evento QueryContinueDrag.Provides data for the QueryContinueDrag event.

public ref class QueryContinueDragEventArgs : EventArgs
[System.Runtime.InteropServices.ComVisible(true)]
public class QueryContinueDragEventArgs : EventArgs
type QueryContinueDragEventArgs = class
    inherit EventArgs
Public Class QueryContinueDragEventArgs
Inherits EventArgs
Herencia
QueryContinueDragEventArgs
Atributos

Ejemplos

En este fragmento de código se QueryContinueDragEventArgs muestra cómo usar QueryContinueDrag la clase con el evento.This code excerpt demonstrates using the QueryContinueDragEventArgs class with the QueryContinueDrag event. Vea el DoDragDrop método para obtener el ejemplo de código completo.See the DoDragDrop method for the complete code example.

void ListDragSource_QueryContinueDrag( Object^ sender, System::Windows::Forms::QueryContinueDragEventArgs^ e )
{
   // Cancel the drag if the mouse moves off the form.
   ListBox^ lb = dynamic_cast<ListBox^>(sender);
   if ( lb != nullptr )
   {
      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 = 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 Sub ListDragSource_QueryContinueDrag(ByVal sender As Object, ByVal e As QueryContinueDragEventArgs) Handles ListDragSource.QueryContinueDrag
    ' Cancel the drag if the mouse moves off the form.
    Dim lb as ListBox = CType(sender, System.Windows.Forms.ListBox)

    If (lb isNot nothing) Then

        Dim f as Form = 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) Or _
            ((Control.MousePosition.X - screenOffset.X) > f.DesktopBounds.Right) Or _
            ((Control.MousePosition.Y - screenOffset.Y) < f.DesktopBounds.Top) Or _
            ((Control.MousePosition.Y - screenOffset.Y) > f.DesktopBounds.Bottom)) Then

            e.Action = DragAction.Cancel
        End If
    End if
End Sub

Comentarios

El QueryContinueDrag evento tiene lugar durante una operación de arrastrar y colocar, y permite al origen de arrastre determinar si se debe cancelar la operación de arrastrar y colocar.The QueryContinueDrag event occurs during a drag-and-drop operation and allows the drag source to determine whether the drag-and-drop operation should be canceled. Un QueryContinueDragEventArgs especifica si la operación de arrastrar y colocar debe continuar, si se ha presionado alguna tecla modificadora y si el usuario ha presionado la tecla ESC.A QueryContinueDragEventArgs specifies whether and how the drag-and-drop operation should proceed, whether any modifier keys are pressed, and whether the user has pressed the ESC key.

De forma predeterminada, el evento QueryContinueDrag establece Action en DragAction.Cancel si se presiona la tecla ESC y establece Action en DragAction.Drop si se presiona el botón izquierdo, central o derecho del mouse.By default, the QueryContinueDrag event sets Action to DragAction.Cancel if the ESC key was pressed and sets Action to DragAction.Drop if the left, middle, or right mouse button is pressed.

Para obtener información sobre el modelo de eventos, vea controlar y provocar eventos.For information about the event model, see Handling and Raising Events.

Constructores

QueryContinueDragEventArgs(Int32, Boolean, DragAction)

Inicializa una nueva instancia de la clase QueryContinueDragEventArgs.Initializes a new instance of the QueryContinueDragEventArgs class.

Propiedades

Action

Obtiene o establece el estado de una operación de arrastrar y colocar.Gets or sets the status of a drag-and-drop operation.

EscapePressed

Averigua si el usuario presionó la tecla ESC.Gets whether the user pressed the ESC key.

KeyState

Obtiene el estado actual de las teclas MAYÚS, CTRL y ALT.Gets the current state of the SHIFT, CTRL, and ALT keys.

Métodos

Equals(Object)

Determina si el objeto especificado es igual al objeto actual.Determines whether the specified object is equal to the current object.

(Heredado de Object)
GetHashCode()

Sirve como la función hash predeterminada.Serves as the default hash function.

(Heredado de Object)
GetType()

Obtiene el Type de la instancia actual.Gets the Type of the current instance.

(Heredado de Object)
MemberwiseClone()

Crea una copia superficial del objeto Object actual.Creates a shallow copy of the current Object.

(Heredado de Object)
ToString()

Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object.

(Heredado de Object)

Se aplica a

Consulte también: