Mouse Pointer not changing (C#)

  • Thread starter Thread starter R-D-C
  • Start date Start date
R

R-D-C

Hi,

I have a process that takes a good ten seconds and want to show an hourglass
mouse pointer.

I am using:

this.Cursor = Cursors.WaitCursor;
Application.DoEvents();

// Long thing

this.Cursor = Cursors.Default;


.... when I run this, the pointer does not change shape until after the long
thing at which point I want it to change back :(

Can anybody help please?
 
More Info:

The call is made as a drop-down list box value changes. If I change the
list value with the mouse, the pointer doesn't change shape. If, however, I
update the value by scrolling up and down with the cursor keys on the
keyboard, the mouse pointer DOES change correctly!

Please help.
 
OK, final bit of info:

Just below the drop-down list is a textbox which happens to be underneath
the option in the drop-down that takes the most time. When I move the
textbox lower on the screen, the mouse pointer changes shape as I want it
to.

AAAAAAGGGGHHHHHH!!!!!!!!
 
And now the solution.

The underlying textbox had a cursor set to IBeam by default. This means
that you specifically have to set the cursor for all textboxes as they will
not default to their parent's pointer.

If you apply the Default pointer type to a textbox this shows an arrow, not
an IBeam as I would have expected.

I think .NET user interface functionality was sent by Microsoft to try us...
 
That's because you were setting the form's Cursor. That will only cascade
down to child controls that don't specify their own Cursor. This is
designed behavior.

Try setting Cursor.Current instead of this.Cursor. It should do what you
want, and you won't have to change anything on your text boxes.
 
Nope, same effect

:(


Joe White said:
That's because you were setting the form's Cursor. That will only cascade
down to child controls that don't specify their own Cursor. This is
designed behavior.

Try setting Cursor.Current instead of this.Cursor. It should do what you
want, and you won't have to change anything on your text boxes.
 
Back
Top