QueryContinueDragEventArgs Class

Definition

Provides data for the QueryContinueDrag event.

C#
[System.Runtime.InteropServices.ComVisible(true)]
public class QueryContinueDragEventArgs : EventArgs
C#
public class QueryContinueDragEventArgs : EventArgs
Inheritance
QueryContinueDragEventArgs
Attributes

Examples

This code excerpt demonstrates using the QueryContinueDragEventArgs class with the QueryContinueDrag event. See the DoDragDrop method for the complete code example.

C#
private void ListDragSource_QueryContinueDrag(object sender, 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;
        }
    }
}

Remarks

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 Handling and Raising Events.

Constructors

Properties

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.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(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)

Applies to

Proizvod Verzije
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also