views:

47

answers:

1

I've got a strange issue that I'm hoping someone might have experienced/have some suggestions on.

I'm using a 3rd party library (GoDiagram), which having reflected it briefly I don't think is the cause of the problem. What happens is that I drag a file onto a background canvas which inherits from the Control class. At the point of dragging a file over the canvas the cursor changes to the 'drag-drop' cursor, which I'm fairly certain is just being handled by the base Control rather than the canvas itself.

At this point the canvas triggers an event that I'm hooked up to. This event displays a modal dialog. At this point the cursor is a normal arrow. However if I return focus to the desktop, my cursor is still in the 'drag-drop' state, and I can't actually interact with any icons on the desktop.

Does anyone know why something like this might happen? Or does anyone know how I can force the cursor to revert? The strange thing is it feels like its the Windows cursor that isn't working, and that the cursor in my app from that point is fine. If I close the dialog box then the cursor returns to the normal cursor wherever I am like you'd expect.

Cheers

A: 

Usually, when you change the cursor type, you first save the previous cursor state; change to new cursor type, perform the work, and then, after you are done change the cursor back to previous cursor type. So this is how everyone(every app) gets a chance to manipulate the cursor type while respecting other apps.

It seems, somehow, when the new modal dialog box opens it does not retain the previous cursor state, let alone reverting back to previous cursor type upon dialog close event.

So, what you can do, is to change the cursor type manually, when that dialog box closes.

--EDIT--

I reread your question; and I am quite not sure(now) if I understand you correctly.

As I understand, the event you are hooked up to displays the dialog box, so does this mean you are the one displaying the modal dialog box?

If so, did you trying manipulating the .MouseEnter and .MouseLeave event to control the cursor type.

KMan
I don't think you quite followed KMan. The cursor changes back correctly when the dialog box closes. It's while the dialog is open (opens within the DragDrop event reciever) and leaves the cursor in this state when I click the desktop while the dialog is still open.
Ian
@Ian: See my edit in response to your comment.
KMan