Results 1 to 3 of 3

Thread: [RESOLVED] Hourglass reverting back to Default Pointer

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2018
    Posts
    160

    Resolved [RESOLVED] Hourglass reverting back to Default Pointer

    Hi

    I have a form with a webbrowser control on it - this loads up a pdf file I select from a file dialogue.

    What I'd like to be able to do is show the hourglass until the page (pdf) is finished loading in the browser.

    I found some code here: https://en.wikibooks.org/wiki/Web_Pr...ual_Basic_.NET which lets me know when the page is loaded (actually the example covers when it's ready to print, but it works the same). I've put this into my code so it looks like this:

    Code:
    Sub Showpage()
    
            AddHandler WebBrowser1.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf ReadyToPrint)
            Me.UseWaitCursor = True
            WebBrowser1.Navigate(my file name)
    
    End Sub
    
    
    Private Sub ReadyToPrint(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs)
    
            ' Create a temporary copy of the web browser object.
            '  At the same time we will assign it a value by coercing the sender argument
            '  that was passed into this method.
            Dim webBrowserTmp As WebBrowser = CType(sender, WebBrowser)
            ' We know that the web page is fully loaded because this method is running.
            ' Therefore we don’t have to check if the WebBrowser object is still busy.
            ' It’s time to print…
            'webBrowserTmp.Print()
            Me.UseWaitCursor = False
            MsgBox("OK page loaded")
    
    End Sub

    The pointer initially goes to the hourglass, and the msgbox is firing OK to tell me the page is loaded, but the problem is that the hourglass goes back to the default pointer before this stage is reached.

    Can anyone suggest how I can get the hourglass to stay until I tell it to go?

    Thanks for reading and Merry Christmas!

  2. #2
    Fanatic Member Arve K.'s Avatar
    Join Date
    Sep 2008
    Location
    Kyrksæterøra, Norway
    Posts
    518

    Re: Hourglass reverting back to Default Pointer

    This is a feature that is built into the WebBrowser control itself.

    I don't think you can change this behaviour unless you do some obscure API calls. My guess is that if you move your cursor outside of the web browser control, you will see that it changes to whatever cursor you have set, but as soon you are entering the web browser again, it will change depending on what work the browser is doing...
    Arve K.

    Please mark your thread as resolved and add reputation to those who helped you solve your problem
    Disclaimer: I am not a professional programmer

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2018
    Posts
    160

    Re: Hourglass reverting back to Default Pointer

    Thanks for your reply - sounds like I'll have to live with it.

    Just one of those things you think should be reasonably easy that turns out to be more trouble than it's worth.

    Cheers!

Tags for this Thread

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