Problems Changing Mouse Cursor Type

J

Jim Frazer

Hi,

I'm working on an application in C# that will allow the user to create
simple CAD drawings on a CEPC system. I would like to be able to change the
cursor shape depending on the drawing mode selected by the user. I started
out by setting up P/Invokes for LoadCursor and SetCursor. Calling
LoadCursor followed by SetCursor does allow me to change to a different
cursor, such as the cross cursor, but as soon as the application leaves the
function in which I make the change, the cursor reverts back to the standard
arrow cursor. I tried a simple test that changed the cursor to the wait
cursor via:

Cursor.Current = Cursors.WaitCursor;

The same behavior occurs. The cursor changes, but reverts to the arrow as
soon as I leave the function where the change was made. I've searched the
archives for this newsgroup but couldn't find anything that would help me.
I'm open to ideas. I'm fluent in C++ dll writing if that would be useful.

Thanks,

Jim Frazer
 
S

scott blood

Jim,

AFAIK you can only set the cursor for a single window. So as you explained,
as soon as you move away from the calling window where the cursor was
changed the cursor changes back to the application default, which is the
pointer.

However, if i am wrong i am sure someone would point this out.

BTW have you tried changing the cursor of the main winform in your
application to see if this has the desired effect.

Regards
Scott Blood
C# Developer
 
J

Jim Frazer

Hi Scott,

I tried changing the cursor in the Form_Load event to no avail. Perhaps
there's a better place than that.

I have a custom control for the drawing area and I would be happy if I could
change the cursor to a desired shape whenever the cursor is in the drawing
area. At the moment, I'm looking at other ways to notify the user that
he/she's in a special drawing mode. Changing cursor shape would be a great
way to do this since that's where the person's eyes are focused.

Thanks for responding.

Jim
 

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