QueryContinueDragEventArgs クラス

定義

QueryContinueDrag イベントのデータを提供します。

public ref class QueryContinueDragEventArgs : EventArgs
[System.Runtime.InteropServices.ComVisible(true)]
public class QueryContinueDragEventArgs : EventArgs
public class QueryContinueDragEventArgs : EventArgs
[<System.Runtime.InteropServices.ComVisible(true)>]
type QueryContinueDragEventArgs = class
    inherit EventArgs
type QueryContinueDragEventArgs = class
    inherit EventArgs
Public Class QueryContinueDragEventArgs
Inherits EventArgs
継承
QueryContinueDragEventArgs
属性

このコードの抜粋は、QueryContinueDragEventArgs イベントで QueryContinueDrag クラスを使用する方法を示しています。 完全なコード例については、 DoDragDrop メソッドを参照してください。

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;
      }
   }
}
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;
        }
    }
}
Private Sub ListDragSource_QueryContinueDrag(ByVal sender As Object, ByVal e As QueryContinueDragEventArgs) Handles ListDragSource.QueryContinueDrag
    ' Cancel the drag if the mouse moves off the form.
    Dim lb As ListBox = CType(sender, ListBox)

    If (lb IsNot Nothing) Then

        Dim f As Form = 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) Or
            ((Control.MousePosition.X - screenOffset.X) > f.DesktopBounds.Right) Or
            ((Control.MousePosition.Y - screenOffset.Y) < f.DesktopBounds.Top) Or
            ((Control.MousePosition.Y - screenOffset.Y) > f.DesktopBounds.Bottom)) Then

            e.Action = DragAction.Cancel
        End If
    End If
End Sub

注釈

QueryContinueDrag イベントは、ドラッグ アンド ドロップ操作中に発生し、ドラッグ ソースがドラッグ アンド ドロップ操作を取り消す必要があるかどうかを判断できるようにします。 QueryContinueDragEventArgsは、ドラッグ アンド ドロップ操作を続行するかどうか、修飾子キーを押すかどうか、およびユーザーが ESC キーを押したかどうかを指定します。

既定では、QueryContinueDragイベントは、esc キーが押された場合にActionDragAction.Cancelを設定し、左、中央、または右のマウス ボタンが押された場合にActionDragAction.Dropに設定します。

イベント モデルの詳細については、「イベントの 処理と発生」を参照してください。

コンストラクター

名前 説明
QueryContinueDragEventArgs(Int32, Boolean, DragAction)

QueryContinueDragEventArgs クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
Action

ドラッグ アンド ドロップ操作の状態を取得または設定します。

EscapePressed

ユーザーが Esc キーを押したかどうかを取得します。

KeyState

Shift キー、Ctrl キー、Alt キーの現在の状態を取得します。

メソッド

名前 説明
Equals(Object)

指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください