System.Windows.Forms.ToolStripItem.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.

Syntax

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ComponentModel.Browsable(false)]
public event QueryContinueDragEventHandler QueryContinueDrag

Remarks

The ToolStripItem.QueryContinueDrag event is raised when there is a change in the keyboard or mouse button state during a drag-and-drop operation. The ToolStripItem.QueryContinueDrag event allows the drag source to determine whether the drag-and-drop operation should be canceled.

The following remarks describe how and when events related to drag-and-drop operations are raised.

The ToolStripItem.DoDragDrop(object, DragDropEffects) method determines the item under the current cursor location. It then checks to see if the item is a valid drop target.

If the item is a valid drop target, the ToolStripItem.GiveFeedback event is raised with the drag-and-drop effect specified. For a list of drag-and-drop effects, see the System.Windows.Forms.DragDropEffects enumeration.

Changes in the mouse cursor position, keyboard state, and mouse button state are tracked in the following manner:

If there is a change in the keyboard or mouse button state, the ToolStripItem.QueryContinueDrag event is raised and determines whether to continue the drag, to drop the data, or to cancel the operation based on the value of the QueryContinueDragEventArgs.Action property of the event's System.Windows.Forms.QueryContinueDragEventArgs.

If the value of System.Windows.Forms.DragAction is Continue, the ToolStripItem.DragOver event is raised to continue the operation and the ToolStripItem.GiveFeedback event is raised with the new effect so appropriate visual feedback can be set. For a list of valid drop effects, see the System.Windows.Forms.DragDropEffects enumeration.

The ToolStripItem.DragOver and ToolStripItem.GiveFeedback events are paired so that as the mouse moves across the drop target, the user is given the most up-to-date feedback on the mouse's position, as follows:

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0