Results 1 to 4 of 4

Thread: [RESOLVED] Show Cursor after hiding it

  1. #1

    Thread Starter
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Resolved [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?
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Fanatic Member manhit45's Avatar
    Join Date
    May 2009
    Location
    Ha noi - Viet Nam
    Posts
    826

    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.
    --***----------***-----

    If i help you please rate me.

    Working with Excel * Working with String * Working with Database * Working with array *

    K51 ĐH BÁCH KHOA HÀ NỘI - Khoa CNTT pro.

  4. #4

    Thread Starter
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: Show Cursor after hiding it

    Quote Originally Posted by jmcilhinney View Post
    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.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width