QueryContinueDragEventArgs Kelas

Definisi

Menyediakan data untuk peristiwa tersebut 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
Warisan
QueryContinueDragEventArgs
Atribut

Contoh

Kutipan kode ini menunjukkan penggunaan QueryContinueDragEventArgs kelas dengan QueryContinueDrag peristiwa . DoDragDrop Lihat metode untuk contoh kode lengkap.

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

Keterangan

Peristiwa QueryContinueDrag terjadi selama operasi seret dan letakkan dan memungkinkan sumber seret untuk menentukan apakah operasi seret dan letakkan harus dibatalkan. QueryContinueDragEventArgs Menentukan apakah dan bagaimana operasi seret dan letakkan harus dilanjutkan, apakah ada tombol pengubah yang ditekan, dan apakah pengguna telah menekan tombol ESC.

Secara default, QueryContinueDrag peristiwa diatur Action ke DragAction.Cancel jika tombol ESC ditekan dan diatur Action ke DragAction.Drop jika tombol mouse kiri, tengah, atau kanan ditekan.

Untuk informasi tentang model peristiwa, lihat Menangani dan Meningkatkan Peristiwa.

Konstruktor

QueryContinueDragEventArgs(Int32, Boolean, DragAction)

Menginisialisasi instans baru kelas QueryContinueDragEventArgs.

Properti

Action

Mendapatkan atau mengatur status operasi seret dan letakkan.

EscapePressed

Mendapatkan apakah pengguna menekan tombol ESC.

KeyState

Mendapatkan status tombol SHIFT, CTRL, dan ALT saat ini.

Metode

Equals(Object)

Menentukan apakah objek yang ditentukan sama dengan objek saat ini.

(Diperoleh dari Object)
GetHashCode()

Berfungsi sebagai fungsi hash default.

(Diperoleh dari Object)
GetType()

Mendapatkan dari instans Type saat ini.

(Diperoleh dari Object)
MemberwiseClone()

Membuat salinan dangkal dari saat ini Object.

(Diperoleh dari Object)
ToString()

Mengembalikan string yang mewakili objek saat ini.

(Diperoleh dari Object)

Berlaku untuk

Lihat juga