QueryContinueDragEventArgs クラス
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)


QueryContinueDrag イベントは、ドラッグ アンド ドロップ操作中に発生し、ドラッグ ソースがドラッグ アンド ドロップ操作をキャンセルする必要があるかどうかを決定できるようにします。QueryContinueDragEventArgs は、ドラッグ アンド ドロップ操作を続行するかどうか、続行する場合はその方法、修飾子キーが押されたかどうか、ユーザーが Esc キーを押したかどうかを指定します。
既定では、Esc キーが押された場合、QueryContinueDrag イベントは Action を DragAction.Cancel に設定します。また、マウスの左右または中央のボタンが押された場合は Action を DragAction.Drop に設定します。

2 つの ListBox コントロールの間でドラッグ アンド ドロップ操作を実行するコード例を次に示します。この例では、ドラッグ アクションが開始したときに DoDragDrop メソッドが呼び出されます。ドラッグ操作は、MouseDown イベント実行中のマウス位置から SystemInformation.DragSize を超えてマウスが移動したときに開始されます。IndexFromPoint メソッドは、MouseDown イベントで、ドラッグする項目のインデックスを判別するために使用します。
この例では、ドラッグ アンド ドロップ操作でカスタム カーソルを使用する方法についても示します。この例では、2 つのカーソル ファイル (3dwarro.cur と 3dwno.cur) がアプリケーション ディレクトリ内に存在していることを想定しています。なお、それぞれのファイルはドラッグ用のカスタム カーソルとドロップなしのカスタム カーソルを表します。カスタム カーソルは、UseCustomCursorsCheckCheckBox がオンになっている場合に使用されます。カスタム カーソルは、GiveFeedback イベント ハンドラで設定されます。
キーボードの状態は、右側の ListBox の DragOver イベント ハンドラで評価されます。ドラッグ操作の内容は、Shift キー、Ctrl キー、Alt キー、または Ctrl + Alt キーの状態によって決まります。ドロップが発生する ListBox 内の位置は、DragOver イベント時にも判定されます。ドロップするデータが String でない場合は、DragEventArgs.Effect が DragDropEffects.None に設定されます。最後に、ドロップのステータスが DropLocationLabelLabel に表示されます。
右側の ListBox にドロップするデータは、DragDrop イベント ハンドラで判定されます。また、String 値が ListBox の該当する場所に追加されます。ドラッグ操作がフォームの範囲を超えて移動した場合、ドラッグ アンド ドロップ操作は QueryContinueDrag イベント ハンドラでキャンセルされます。
QueryContinueDrag イベントで QueryContinueDragEventArgs クラスを使用する例を次に示します。コード例全体については、DoDragDrop メソッドのトピックを参照してください。
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, System.Windows.Forms.ListBox) If Not (lb is 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
private void ListDragSource_QueryContinueDrag(object sender, System.Windows.Forms.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; } } }
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, System.Windows.Forms.QueryContinueDragEventArgs e) { // Cancel the drag if the mouse moves off the form. ListBox lb = (ListBox)sender; 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.get_MousePosition().get_X() - screenOffset.get_X() < f.get_DesktopBounds().get_Left() || Control.get_MousePosition().get_X() - screenOffset.get_X() > f.get_DesktopBounds().get_Right() || Control.get_MousePosition().get_Y() - screenOffset.get_Y() < f.get_DesktopBounds().get_Top() || Control.get_MousePosition().get_Y() - screenOffset.get_Y() > f.get_DesktopBounds().get_Bottom()) { e.set_Action(DragAction.Cancel); } } } //listDragSource_QueryContinueDrag

System.EventArgs
System.Windows.Forms.QueryContinueDragEventArgs


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


QueryContinueDragEventArgs コンストラクタ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim keyState As Integer Dim escapePressed As Boolean Dim action As DragAction Dim instance As New QueryContinueDragEventArgs(keyState, escapePressed, action)
public function QueryContinueDragEventArgs ( keyState : int, escapePressed : boolean, action : DragAction )
- action
DragAction 値。

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


QueryContinueDragEventArgs プロパティ

名前 | 説明 | |
---|---|---|
![]() | Action | ドラッグ アンド ドロップ操作のステータスを取得または設定します。 |
![]() | EscapePressed | ユーザーが Esc キーを押したかどうかを取得します。 |
![]() | KeyState | Shift、Ctrl、Alt の各キーの現在の状態を取得します。 |

QueryContinueDragEventArgs メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

QueryContinueDragEventArgs メンバ
QueryContinueDrag イベントのデータを提供します。
QueryContinueDragEventArgs データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | Action | ドラッグ アンド ドロップ操作のステータスを取得または設定します。 |
![]() | EscapePressed | ユーザーが Esc キーを押したかどうかを取得します。 |
![]() | KeyState | Shift、Ctrl、Alt の各キーの現在の状態を取得します。 |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- QueryContinueDragEventArgsのページへのリンク