QueryContinueDragEventArgs Class
Provides data for the QueryContinueDrag event.
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.
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; } } }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
