views:

61

answers:

3

Hello everybody,

In my program with a UI in WinForm. I set the cursor to a hourglass just before to launch a method in ThreadPool.

My code in UI thread to set the cursor looks like this :

Application.UseWaitCursor = true;

When the method is finished, i go back to the UI Thread to set the cursor to the normal case.

Application.UseWaitCursor = false;

My problem is the cursor stay to the Hourglass till I don't move the mouse. It's a little bit disturbing if the user wait on the end of the action without moving the mouse.

Anyone can help me ?

Jérôme

A: 

Set the cursor manually. That's what I do.

leppie
How can you do this ?
RedPaladin
`control.Cursor = Cursors.Busy`
leppie
@leppie - I think it should be `control.Cursor = Cursors.WaitCursor`
Barry
@barry: thanks, I couldn't remember, but the idea is still the same :)
leppie
A: 

I am unable to reproduce this behaviour? It works fine for me.

One thing to note though if you use the Control.Cursor = Cursors.WaitCursor approach is that it usually used like so:

this.Cursor = Cursors.WaitCursor

Which would appear to work fine, however, this refers the form so if the user moves the mouse to a different control, e.g a TextBox then the mouse does not show the wait cursor.

This may cause confusion for the users. Or could cause some issues if the user continues to work on something else when the Application is busy doing other work.

Barry
Finally I have changed the Cursor Property on the main Form instead of Application.UseWaitCursor and the behavior of my cursor is what I have expected. I have no idea what the problem is coming from...
RedPaladin
A: 

One more way:

Cursor.Current = Cursors.WainCursor;

When finished, just change the cursor back:

Cursor.Current = Cursors.Default;
26071986