Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Hide Cursor in C#

I need to hide the mouse cursor in a C# app on one form only...however when I use the Cursor.Hide method it hides it for all forms in my app...Is there a way to specify that only on certain forms it is hidden? thanks.
[217 byte] By [Kamikazi] at [2007-11-11 10:20:09]
# 1 Re: Hide Cursor in C#
You might want to use the Form.Activate event to make the cursor visible/non-visible
joewmaki at 2007-11-11 20:48:15 >
# 2 Re: Hide Cursor in C#
I'm not sure what you mean...It will still hide the Cursor from all forms if you do Cursor.Hide on the activate event...
Kamikazi at 2007-11-11 20:49:09 >
# 3 Re: Hide Cursor in C#
Good point My thought was to hide the cursor when activating one form and unhide it when activating the others. Not sure how well this would work with a hidden cursor. :D

Maybe you could explain why you need to hide the cursor. If it's this difficult to do, it may not be a good idea from a UI standpoint.
joewmaki at 2007-11-11 20:50:15 >
# 4 Re: Hide Cursor in C#
It's a program with 2 forms...form1 loads and then loads multiple instances of form2...form2 just displays text or images and needs the cursor hidden. Form1 just has a log of any errors displayed on it and is hidden in the task tray until needed...Form2 is left to do it's own thing and there is no user interaction at all. It's not important to have form1 do anything at all as the rest is just automated from another program...But it would just be nice. :)

thanks anyway!
Kamikazi at 2007-11-11 20:51:21 >