Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

How do you set the mouse cursor to nothing. I want the ability to hide and show the cursor on my form.

 

I can think of a work around whereby I move the cursor to the bottom left corner of the screen but this isn't ideal.

TT

(*_*)

 

There are 10 types of people in this world;

those that understand binary and those that don't.

Posted
You can use Cursor.Hide() and Cursor.Show()

 

OMG! :eek: I can't believe I missed that!

 

How stupid do I feel??? :confused:

 

 

 

Thanks.

TT

(*_*)

 

There are 10 types of people in this world;

those that understand binary and those that don't.

Posted

I'm still having trouble with this. I have a form with a timer that detects when the mouse moves and then displays a couple of buttons and the mouse cursor. After 3 seconds it is then supposed to hide the buttons and the mouse cursor. Unfortunately, it does't hide the mouse cursor.

 

The form code is attached.

 

:confused: :confused: :confused:

frmdisplay.vb

TT

(*_*)

 

There are 10 types of people in this world;

those that understand binary and those that don't.

  • Leaders
Posted

try something like this :

Dim x As Integer = 0
'/// somewhere near top of your form ( under windows generated code )
'//////////
   Private Sub Form1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.MouseEnter
       Timer1.Start()
       Button2.Visible = True
       Button3.Visible = True
   End Sub

   Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
       x += 1
       If x = 3 Then
           Timer1.Stop()
           Button2.Visible = False
           Button3.Visible = False
           x = 0 '/// reset the counter
       End If
   End Sub

Posted
One thing about Cursor.Show()/Hide() is that it doesn't seem to work if not invoked on the main thread. In my first reply to your post, I tested it first on a separate thread but it didn't work. Maybe that behavior is related to what you're experiencing now since you're trying to invoke Cursor.Show()/Hide() from the Tick event of a timer.
  • 2 years later...
Posted

Another way...

 

With this I get error messages about intances and such:

You can use Cursor.Hide() and Cursor.Show()

 

But this API worked nicely:

Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Boolean) As Long

 

And simply call it like this:

ShowCursor(False)
ShowCursor(True)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...