Cursor.Current reverting to default

  • Thread starter Juan Manuel Formoso
  • Start date
J

Juan Manuel Formoso

Hi, I have a custom made toggle button, and I want to change the cursor
in my application when it's pressed.

I set the Cursor.Current property whenever that state changes, but on
mouseup it reverts back to the default cursor automatically.

I did a few tests, and putting a button in a blank form, setting the
Cursor.Current property OnMouseEnter, only changes the cursor in the
border of the button. If I keep moving it it reverts again to default.

Is there a way to force the cursor to stay as I set it until I manually
set it to Cursors.Default?

Regards,
Juan Manuel.
 
C

Chris Dunaway

Are you calling Application.DoEvents anywhere? From the docs:

If you call Application.DoEvents before resetting the Current property
back to the Cursors.Default cursor, the application will resume
listening for mouse events and will resume displaying the appropriate
Cursor for each control in the application.
 
J

Juan Manuel Formoso

Nope, I create a new project, add a button, change the cursor on the
Click event, and OnMouseUp the cursor reverts to default... I do
nothing else...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top