QueryContinueDragEventArgs Osztály
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Adatokat biztosít az QueryContinueDrag eseményhez.
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
- Öröklődés
- Attribútumok
Példák
Ez a kódrészlet az osztály eseményhez való QueryContinueDragEventArgs használatát QueryContinueDrag mutatja be. Tekintse meg a DoDragDrop teljes kód példájának metódusát.
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
Megjegyzések
Az QueryContinueDrag esemény egy húzási művelet során következik be, és lehetővé teszi a húzási forrás számára annak megállapítását, hogy a húzási művelet megszakítható-e. Az A QueryContinueDragEventArgs azt határozza meg, hogy a húzási műveletnek folytatódnia kell-e, hogy a módosító kulcsok lenyomva legyenek-e, és hogy a felhasználó lenyomta-e az ESC-kulcsot.
Alapértelmezés szerint az esemény azt QueryContinueDrag állítja be Action , hogy DragAction.Cancel az ESC-kulcsot lenyomták-e, és ActionDragAction.Drop hogy a bal, középső vagy jobb egérgomb lenyomva van-e.
Az eseménymodellről további információt az Események kezelése és emelése című témakörben talál.
Konstruktorok
| Name | Description |
|---|---|
| QueryContinueDragEventArgs(Int32, Boolean, DragAction) |
Inicializálja a QueryContinueDragEventArgs osztály új példányát. |
Tulajdonságok
| Name | Description |
|---|---|
| Action |
Lekéri vagy beállítja egy húzási művelet állapotát. |
| EscapePressed |
Lekérdezi, hogy a felhasználó lenyomta-e az ESC-kulcsot. |
| KeyState |
Lekéri a SHIFT, a CTRL és az ALT billentyűk aktuális állapotát. |
Metódusok
| Name | Description |
|---|---|
| Equals(Object) |
Meghatározza, hogy a megadott objektum egyenlő-e az aktuális objektummal. (Öröklődés forrása Object) |
| GetHashCode() |
Ez az alapértelmezett kivonatoló függvény. (Öröklődés forrása Object) |
| GetType() |
Lekéri az Type aktuális példányt. (Öröklődés forrása Object) |
| MemberwiseClone() |
Az aktuális Objectpéldány sekély másolatát hozza létre. (Öröklődés forrása Object) |
| ToString() |
Az aktuális objektumot jelképező sztringet ad vissza. (Öröklődés forrása Object) |