问题
is it possible to change the cursor even when the cursor is at outside of the form?
I used MouseHook by using Win32 API to capture the location of the Cursor when it is outside the form. However, I cannot change the cursor...
回答1:
Programs decide what the cursor should look like. Most windows ask for the default arrow. But, say, a text box control asks for an I-Beam. A hyperlink control asks for the hand. Etcetera. And if you hover over a window edge of a resizable window then the program asks for one of the resizing cursors. Or a program goes off doing something for a while and asks for the hourglass cursor. Etcetera.
Replacing the cursor is thus fraught with trouble, you cannot make correct cursor choices for another program you know nothing about.
You can technically pinvoke SetSystemCursor() to replace one of the system cursors. But that's very troublesome as well, you won't restore it properly when your program bombs. A reboot is required to fix the problem. Also very detrimental to a user with visual impairments, you'll replace the Extra Large cursors she selected with a puny one.
This needs to be a user selection, they go Control Panel + Mouse to select cursors.
回答2:
Maybe you should with try the events MouseEnter and MouseLeave
来源:https://stackoverflow.com/questions/11520911/c-sharp-changing-cursor-even-when-the-cursor-is-outside-the-form