QueryContinueDragEventArgs Classe
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Fournit des données pour l’événement QueryContinueDrag.
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
- Héritage
- Attributs
Exemples
Cet extrait de code illustre l’utilisation de la QueryContinueDragEventArgs classe avec l’événement QueryContinueDrag . Consultez la DoDragDrop méthode de l’exemple de code complet.
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
Remarques
L’événement QueryContinueDrag se produit pendant une opération de glisser-déplacer et permet à la source de glisser-déplacer de déterminer si l’opération glisser-déplacer doit être annulée. Indique QueryContinueDragEventArgs si et comment l’opération glisser-déplacer doit se poursuivre, si les touches de modificateur sont enfoncées et si l’utilisateur a appuyé sur la touche ÉCHAP.
Par défaut, l’événement QueryContinueDrag est défini ActionDragAction.Cancel sur si la touche ÉCHAP a été enfoncée et si ActionDragAction.Drop le bouton gauche, central ou droit de la souris est enfoncé.
Pour plus d’informations sur le modèle d’événement, consultez Gestion et déclenchement d’événements.
Constructeurs
| Nom | Description |
|---|---|
| QueryContinueDragEventArgs(Int32, Boolean, DragAction) |
Initialise une nouvelle instance de la classe QueryContinueDragEventArgs. |
Propriétés
| Nom | Description |
|---|---|
| Action |
Obtient ou définit l’état d’une opération de glisser-déplacer. |
| EscapePressed |
Obtient si l’utilisateur a appuyé sur la touche Échap. |
| KeyState |
Obtient l’état actuel des touches Maj, Ctrl et Alt. |
Méthodes
| Nom | Description |
|---|---|
| Equals(Object) |
Détermine si l’objet spécifié est égal à l’objet actuel. (Hérité de Object) |
| GetHashCode() |
Sert de fonction de hachage par défaut. (Hérité de Object) |
| GetType() |
Obtient la Type de l’instance actuelle. (Hérité de Object) |
| MemberwiseClone() |
Crée une copie superficielle du Objectactuel. (Hérité de Object) |
| ToString() |
Retourne une chaîne qui représente l’objet actuel. (Hérité de Object) |