G
Guest
While developing a drag&drop enabled application I found out this
"strange" behaviour: if I put a message box into the QueryContinueDrag
event handler the message box is shown but the mouse cursor is set to
WaitCursor (Hourglass) and I can't click on OK or on X, so that the
only way to close the message box is via the keyboard, by pressing
SPACE key.
The most strange thing is that if I place two message boxes, only the
first one is affected by the issue described: it seems that the
unloading of the first message box someway "resets" the mouse.
The steps to reproduce this are simple:
1) Create a new Windows Forms Project
2) Place a ListView control on the form
3) Paste the following code:
====8<===CODE================================
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ListView1.View = View.List
ListView1.Items.Add("test")
End Sub
Private Sub ListView1_ItemDrag(ByVal sender As Object, ByVal e As
System.Windows.Forms.ItemDragEventArgs) Handles ListView1.ItemDrag
If e.Button = Windows.Forms.MouseButtons.Left Then
ListView1.DoDragDrop("something to drag",
DragDropEffects.Move)
End If
End Sub
Private Sub ListView1_QueryContinueDrag(ByVal sender As Object,
ByVal e As System.Windows.Forms.QueryContinueDragEventArgs) Handles
ListView1.QueryContinueDrag
If e.Action = DragAction.Drop Then
MsgBox("First Message") 'press SPACEBAR to hide this
MsgBox("Second message") 'this can be hidden the usual
way
End If
End Sub
====8<===CODE - END==========================
4) Run the application
3) Try to drag&drop the "test" item somewhere
I'm using Visual Studio 2005 ver. 8.0.50727.42
Any Suggestion?
Thanks
Roberto
"strange" behaviour: if I put a message box into the QueryContinueDrag
event handler the message box is shown but the mouse cursor is set to
WaitCursor (Hourglass) and I can't click on OK or on X, so that the
only way to close the message box is via the keyboard, by pressing
SPACE key.
The most strange thing is that if I place two message boxes, only the
first one is affected by the issue described: it seems that the
unloading of the first message box someway "resets" the mouse.
The steps to reproduce this are simple:
1) Create a new Windows Forms Project
2) Place a ListView control on the form
3) Paste the following code:
====8<===CODE================================
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ListView1.View = View.List
ListView1.Items.Add("test")
End Sub
Private Sub ListView1_ItemDrag(ByVal sender As Object, ByVal e As
System.Windows.Forms.ItemDragEventArgs) Handles ListView1.ItemDrag
If e.Button = Windows.Forms.MouseButtons.Left Then
ListView1.DoDragDrop("something to drag",
DragDropEffects.Move)
End If
End Sub
Private Sub ListView1_QueryContinueDrag(ByVal sender As Object,
ByVal e As System.Windows.Forms.QueryContinueDragEventArgs) Handles
ListView1.QueryContinueDrag
If e.Action = DragAction.Drop Then
MsgBox("First Message") 'press SPACEBAR to hide this
MsgBox("Second message") 'this can be hidden the usual
way
End If
End Sub
====8<===CODE - END==========================
4) Run the application
3) Try to drag&drop the "test" item somewhere
I'm using Visual Studio 2005 ver. 8.0.50727.42
Any Suggestion?
Thanks
Roberto