QueryContinueDragEventArgs Klasse

Definition

Stellt Daten für das QueryContinueDrag-Ereignis bereit.

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

Beispiele

Dieser Codeauszug veranschaulicht die Verwendung der QueryContinueDragEventArgs Klasse mit dem QueryContinueDrag Ereignis. Sehen Sie sich die DoDragDrop Methode für das vollständige Codebeispiel an.

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

Hinweise

Das QueryContinueDrag Ereignis tritt während eines Drag-and-Drop-Vorgangs auf und ermöglicht der Ziehquelle zu bestimmen, ob der Drag-and-Drop-Vorgang abgebrochen werden soll. Ein 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.

Standardmäßig legt Action das QueryContinueDrag Ereignis festDragAction.Cancel, ob die ESC-Taste gedrückt wurde, und legt fest DragAction.DropAction, ob die linke, mittlere oder rechte Maustaste gedrückt wird.

Informationen zum Ereignismodell finden Sie unter Behandeln und Auslösen von Ereignissen.

Konstruktoren

Name Beschreibung
QueryContinueDragEventArgs(Int32, Boolean, DragAction)

Initialisiert eine neue Instanz der QueryContinueDragEventArgs-Klasse.

Eigenschaften

Name Beschreibung
Action

Dient zum Abrufen oder Festlegen des Status eines Drag-and-Drop-Vorgangs.

EscapePressed

Ruft ab, ob der Benutzer die ESC-Taste gedrückt hat.

KeyState

Ruft den aktuellen Status der UMSCHALT-, STRG- und ALT-TASTE ab.

Methoden

Name Beschreibung
Equals(Object)

Bestimmt, ob das angegebene Objekt gleich dem aktuellen Objekt ist.

(Geerbt von Object)
GetHashCode()

Dient als Standardhashfunktion.

(Geerbt von Object)
GetType()

Ruft die Type der aktuellen Instanz ab.

(Geerbt von Object)
MemberwiseClone()

Erstellt eine flache Kopie der aktuellen Object.

(Geerbt von Object)
ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.

(Geerbt von Object)

Gilt für:

Weitere Informationen