QueryContinueDragEventArgs::Action Property
.NET Framework (current version)
Gets or sets the status of a drag-and-drop operation.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
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.
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; } } }
.NET Framework
Available since 1.1
Available since 1.1
Show: