Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub MyControl_QueryContinueDrag(ByVal sender As Object, ByVal e As System.Windows.Forms.QueryContinueDragEventArgs) Handles MyControl.QueryContinueDrag
- Dim MousePointerLocation As Point = MousePosition
- If e.Action = DragAction.Cancel Then '' User pressed the Escape button
- DragDropInProgressFlag = False
- End If
- If e.Action = DragAction.Drop Then
- If Not HitTest(new {MyControl1, MyControl2}, MousePointerLocation) Then
- DragDropInProgressFlag = False
- End If
- End If
- End Sub
- Private Function HitTest(ByVal ctls() As Control, ByVal p As Point) As Boolean
- HitTest = False
- For Each ctl In ctls
- Dim ClientPoint As Point = ctl.PointToClient(p)
- HitTest = HitTest Or (ClientPoint.X >= 0 AndAlso ClientPoint.Y >= 0 AndAlso ClientPoint.X <= ctl.Width AndAlso ClientPoint.Y <= ctl.Height)
- If HitTest Then Exit For
- Next
- End Function
Add Comment
Please, Sign In to add comment