views:

277

answers:

3

Hi,

I am developing a full-screen application which contains some animated Forms controls (basically, labels which move).

I want to hide the cursor after a period of inactivity, and I have tried using the method given in this thread: http://stackoverflow.com/questions/744980/hide-mouse-cursor-after-an-idle-time

While this works in a sense, the Forms timer does not even begin counting until the form has no more updates (useless for my needs). Additionally, once the cursor is hidden, it is re-shown when a control is moved (i.e one of the labels is animated).

What I need is for Windows to ignore whatever is going on with the display itself, and just obey my 'Cursor.Hide()' and 'Cursor.Show()' calls. I tried using a normal Threading Timer, but this didn't work at all - the cursor didn't even hide.

So I guess what I'm asking for is a way to hide the cursor whilst allowing animations to take place without re-showing the cursor.

Any help is much appreciated. Tom

A: 

There seem to be a bug http://social.msdn.microsoft.com/Forums/en-US/smallbasic/thread/2b963082-c5a7-469c-ba35-02b4a546f913/

What you could possibly try is to assign own custom cursor with 100% transparent bitmap - that looks like there is no cursor.

Ray
A: 

Threading timer method calls don't execute on the thread that created them so for the calls to work, you'd have to make those calls via an invoke on the UI thread.

TreeUK
That's what I'm doing - but still the cursor does not hide. I'm not sure why this is - the code is executed but nothing happens.
TomFromThePool
Sorry, I'm no expert on winforms. Good luck though :)
TreeUK
+2  A: 

A guess, why not have a toggle on which will just handle all WM_ messages which are related to mouse in a wndproc and just do nothing. On toggle off, let the normal processing of WM_ mouse messages take place.

P.K
This seems to be the way to go, but I'm having mixed results so far. I think this will probably end up being the answer, so thanks!
TomFromThePool