QueryContinueDragEventArgs Class
Provides data for the QueryContinueDrag event.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The QueryContinueDragEventArgs type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | QueryContinueDragEventArgs | Initializes a new instance of the QueryContinueDragEventArgs class. |
| Name | Description | |
|---|---|---|
![]() | Action | Gets or sets the status of a drag-and-drop operation. |
![]() | EscapePressed | Gets whether the user pressed the ESC key. |
![]() | KeyState | Gets the current state of the SHIFT, CTRL, and ALT keys. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
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. 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.
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.
For information about the event model, see Events and Delegates.
This code excerpt demonstrates using the QueryContinueDragEventArgs class with the QueryContinueDrag event. See the DoDragDrop method for the complete code example.
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; } } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
