Results 1 to 3 of 3

Thread: webbrowser control

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    262

    webbrowser control

    Am just starting to use a web browser control.

    I've added some handlers like so

    VB Code:
    1. Private Sub AxWebBrowser1_DocumentComplete(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles AxWebBrowser1.DocumentComplete
    2.         Dim doc As mshtml.HTMLDocument
    3.         doc = CType(AxWebBrowser1.Document, mshtml.HTMLDocument)
    4.         Dim iEvent As mshtml.HTMLDocumentEvents2_Event
    5.         iEvent = CType(doc, mshtml.HTMLDocumentEvents2_Event)
    6.         AddHandler iEvent.onclick, AddressOf ClickEventHandler
    7.         AddHandler iEvent.onmouseover, AddressOf MouseOverEventHandler
    8.         AddHandler iEvent.onmouseout, AddressOf MouseoutEventHandler
    9.        
    10.     End Sub


    These fire the following fine

    VB Code:
    1. Private Sub MouseoutEventHandler(ByVal e As mshtml.IHTMLEventObj)
    2.         Me.Timer2.Enabled = True
    3.     End Sub
    4.  
    5.     Private Sub entform()
    6.  
    7.         If Me.Opacity < 1.0 Then
    8.             Me.Opacity = 1.0
    9.         End If
    10.    
    11.  
    12.         Me.Timer2.Enabled = False
    13.        
    14.     End Sub
    15.     Private Sub MouseOverEventHandler(ByVal e As mshtml.IHTMLEventObj)
    16.         entform()
    17.     End Sub
    18.  
    19.   Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
    20.         If Me.Opacity > 0.2 Then
    21.             Me.Opacity = Me.Opacity - 0.01
    22.         Else
    23.             Me.Timer2.Enabled = False
    24.            
    25.         End If
    26.  
    27.  
    28.  
    29.     End Sub

    But after about 2minutes the MouseOverEventHandler stops working. Why would this be, and how do I stop this happening.

  2. #2
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Post Re: webbrowser control

    MouseOverEventHandler calls entform which clearly stops the timer. Your code stops it.

    Just because the mouse goes over something, don't expect that it will ever leave it. You can Alt-Tab away from the program, move the mouse, and then Alt-Tab back. In this case, the mouse out will never fire.
    ~Peter


  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    262

    Re: webbrowser control

    No I'm testing this program so the mouse is leaving and entering the form. When the mouse leaves the form it slowly becomes transparent, each time the timer fires it becomes that little bit more transparent.
    When the mouse renters the form it becomes solid again.

    This all works fine for the first minute or so, but at some point the MouseOverEventHandler stops firing, even though I am moving the mouse over the form. This only seems to be an issue with the mouse over of the web control, as it works fine for other controls.

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