QueryContinueDragEventArgs 类

定义

QueryContinueDrag 事件提供数据。

C#
[System.Runtime.InteropServices.ComVisible(true)]
public class QueryContinueDragEventArgs : EventArgs
C#
public class QueryContinueDragEventArgs : EventArgs
继承
QueryContinueDragEventArgs
属性

示例

此代码摘录演示如何将 QueryContinueDragEventArgs 类与 事件一起使用 QueryContinueDrag 。 有关完整的代码示例, DoDragDrop 请参阅 方法。

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;
        }
    }
}

注解

QueryContinueDrag 事件在拖放操作期间发生,并允许拖动源确定是否应取消拖放操作。 指定 QueryContinueDragEventArgs 是否以及如何继续拖放操作,是否按下任何修改键,以及用户是否按下了 ESC 键。

默认情况下,如果按 Esc 键,则 QueryContinueDrag 事件将 Action 设置为 DragAction.Cancel;如果按鼠标左键、中键或右键,则将 Action 设置为 DragAction.Drop

有关事件模型的信息,请参阅 处理和引发事件

构造函数

属性

Action

获取或设置拖放操作的状态。

EscapePressed

获取该用户是否按下 Esc 键。

KeyState

获取 Shift、Ctrl 和 Alt 键的当前状态。

方法

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()

返回表示当前对象的字符串。

(继承自 Object)

适用于

产品 版本
.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

另请参阅