[RESOLVED] Show Cursor after hiding it
I don't know what's wrong but in my code I can't show the cursor. .Hide() will succesfully hide the cursor but then .Show() does nothing.
Code:
If moveTimer.Enabled Then Windows.Forms.Cursor.Hide() Else Windows.Forms.Cursor.Show() : MsgBox("wdf")
Basically while the game is running, I need the cursor hidden. That part works, but when the game pauses, I need the cursor back and .Show() isn't working. I have a msgbox to check and make sure that the Else side actually executes when the game is paused, and it does so I know .Show() is executing. Does anyone know why the cursor won't re-appear?
Re: Show Cursor after hiding it
Is it possible that you're calling Hide multiple times before calling Show? If so then that's the problem. As the documentation says:
Quote:
The Show and Hide method calls must be balanced. For every call to the Hide method there must be a corresponding call to the Show method.
If you call Hide twice then you must call Show twice, etc.
Re: Show Cursor after hiding it
I think you met problem about threading. You can change condition to determine when game pause then cursor show. .
For example :
When game start( running) you can set a condition label1.text=1 for instance.
when game over , you set condition label1.text = 0.
in event label1.textchanged you add code :
Code:
If label1.text = 0 Then
Windows.Forms.Cursor.Show()
ElseIf label1.text =1 Then
Windows.Forms.Cursor.Hide()
End If
Re: Show Cursor after hiding it
Quote:
Originally Posted by
jmcilhinney
Is it possible that you're calling Hide multiple times before calling Show? If so then that's the problem. As the documentation says:If you call Hide twice then you must call Show twice, etc.
Yes that's it, I will shun myself for not looking in the Library. I actually hardly use it as google is better and will return MSDN results, but this time it didn't come up so I assumed it didn't have enough on it.
Quote:
I think you met problem about threading. You can change condition to determine when game pause then cursor show. .
For example :
When game start( running) you can set a condition label1.text=1 for instance.
when game over , you set condition label1.text = 0.
in event label1.textchanged you add code :
Thanks, I was just thinking how I could fix the multi-hide and a variant on this sounds good.:thumb: