424,303 Members | 1,366 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,303 IT Pros & Developers. It's quick & easy.

Problems Changing Mouse Cursor Type

P: n/a
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

Mar 20 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
"Jim Frazer" <ji*@nospam.net> wrote in message
news:uD**************@TK2MSFTNGP09.phx.gbl...
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

Mar 20 '06 #2

P: n/a
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

"scott blood" <sc*********@hotmail.com> wrote in message
news:O3**************@tk2msftngp13.phx.gbl...
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
"Jim Frazer" <ji*@nospam.net> wrote in message
news:uD**************@TK2MSFTNGP09.phx.gbl...
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


Mar 20 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.