|
-
May 17th, 2009, 10:46 PM
#1
Thread Starter
Fanatic Member
[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?
-
May 17th, 2009, 11:12 PM
#2
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:
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.
-
May 18th, 2009, 12:26 AM
#3
Fanatic Member
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
Last edited by manhit45; May 18th, 2009 at 12:40 AM.
-
May 18th, 2009, 05:40 PM
#4
Thread Starter
Fanatic Member
Re: Show Cursor after hiding it
 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.
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|