While developing a drag&drop enabled application I found out this
"strange" behaviour: if I put a message box into the QueryContinueDr ag
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(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
ListView1.View = View.List
ListView1.Items .Add("test")
End Sub
Private Sub ListView1_ItemD rag(ByVal sender As Object, ByVal e As
System.Windows. Forms.ItemDragE ventArgs) Handles ListView1.ItemD rag
If e.Button = Windows.Forms.M ouseButtons.Lef t Then
ListView1.DoDra gDrop("somethin g to drag",
DragDropEffects .Move)
End If
End Sub
Private Sub ListView1_Query ContinueDrag(By Val sender As Object,
ByVal e As System.Windows. Forms.QueryCont inueDragEventAr gs) Handles
ListView1.Query ContinueDrag
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