Provides data for the QueryContinueDrag event.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Thetype exposes the following members.
|Equals(Object)||Determines whether the specified object is equal to the current object. (Inherited from Object.)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)|
|GetHashCode||Serves as the default hash function. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
The QueryContinueDrag event occurs during a drag-and-drop operation and allows the drag source to determine whether the drag-and-drop operation should be canceled. A 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.
For information about the event model, see Handling and Raising Events.
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 (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