Mouse events on webbrowser or region

mcdonger

Member
Joined
Mar 18, 2007
Messages
16
Location
England
Programming Experience
1-3
The webbrowser control does not have mouseevents (ie mouseup, musedown, mousemove)

I need to detect mouse events on a webbrowser.

Is there any way to detect mouseevents on a region? Or can anyone point me in the direction of how to add mouseevents to a custom control (inherited from the webbrowser)
Also, whilst I'm posting and on the topic, does anyone know how to add a combobox to the properties window of a custom control (using proprty..get..set..end property)

Thanks :)
 
Look into AttachEventHandler/RemoveEventHandler methods of the Document (property) that WebBrowser control hosts.
 
Umm, I don't want to sound thick, but where do i find/ use attatcheventhandler? Could you provide me with a small piece of sample code & where it needs to be? Thanks
 
online doc page: HtmlDocument.AttachEventHandler Method
VB.NET:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    WebBrowser1.GoHome()
    While WebBrowser1.ReadyState <> WebBrowserReadyState.Complete
        Application.DoEvents()
    End While
    WebBrowser1.Document.AttachEventHandler("onclick", AddressOf wb_click)
End Sub

Sub wb_click(ByVal sender As Object, ByVal e As EventArgs)
    MsgBox(WebBrowser1.Document.ActiveElement.TagName)
End Sub
This is also relevant and may be interesting: Accessing Unexposed Members on the Managed HTML Document Object Model
And this: HTML 4.0 Event Attributes
 
Back
Top