QueryContinueDragEventArgs Classe

Definição

Fornece dados para o evento de 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
Herança
QueryContinueDragEventArgs
Atributos

Exemplos

Este trecho de código demonstra o uso da classe QueryContinueDragEventArgs com o evento QueryContinueDrag.This code excerpt demonstrates using the QueryContinueDragEventArgs class with the QueryContinueDrag event. Consulte o método DoDragDrop para obter o exemplo 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

Comentários

O evento de QueryContinueDrag ocorre durante uma operação de arrastar e soltar e permite que a origem de arrastar determine se a operação de arrastar e soltar deve ser cancelada.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. Um QueryContinueDragEventArgs especifica se e como a operação de arrastar e soltar deve continuar, se qualquer tecla modificadora é pressionada e se o usuário pressionou a 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.

Por padrão, o evento QueryContinueDrag define Action como DragAction.Cancel se a tecla ESC foi pressionada e define Action como DragAction.Drop se o botão esquerdo, central ou direito do mouse é pressionado.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 obter informações sobre o modelo de evento, consulte manipulando e gerando eventos.For information about the event model, see Handling and Raising Events.

Construtores

QueryContinueDragEventArgs(Int32, Boolean, DragAction)

Inicializa uma nova instância da classe QueryContinueDragEventArgs.Initializes a new instance of the QueryContinueDragEventArgs class.

Propriedades

Action

Obtém ou define o status de uma operação do tipo "arrastar e soltar".Gets or sets the status of a drag-and-drop operation.

EscapePressed

Obtém se o usuário pressionou a tecla ESC.Gets whether the user pressed the ESC key.

KeyState

Obtém o estado atual das teclas SHIFT, CTRL e ALT.Gets the current state of the SHIFT, CTRL, and ALT keys.

Métodos

Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object.

(Herdado de Object)
GetHashCode()

Serve como a função de hash padrão.Serves as the default hash function.

(Herdado de Object)
GetType()

Obtém o Type da instância atual.Gets the Type of the current instance.

(Herdado de Object)
MemberwiseClone()

Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object.

(Herdado de Object)
ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object.

(Herdado de Object)

Aplica-se a

Veja também