Selecting part of the webbrowser content



Hello,

I want to extend the webbrowser control to allow a user to select part
of a webpage using the mouse (drawing a rectangle with xorpen as the
user moves the mouse with the left button down), and then show the part
of the dom that best corresponds to the selection.

I already can show the dom in a treeview; I also know that
document.activeelement points to the selected tag when a user selects
directly in the browser window. Now I would just like to draw the
rectangle over the webbrowser and then get the selected part.

So what I need is to be able to intercept mouse events (mousedown,
mouseup, mousemove), wm_paint and then probably programatically make a
selection on the user's behalf at the center of the rectangle. I don't
know if there's a more elegant way, like some method that returns the
IHTMLDomNode at (x,y).
If there's no good way to do this, maybe I'll try to insert a
transparent panel on top of the webbrowser and cheat it.

I'm using webbrowser in c#. I used this (quite cool) project:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=4737&lngWId=10


I already read a few threads on the difficulties of drawing over
IWebBrowser2. I would still like to give it a try; if it doesn't show
the user's rectangle over flash animations, that's fine; it's logical
because flash is yet another activex embedded in webbrowser. I suppose
it would be possible to intercept wm_paint of child controls and draw
the part that matters over them but I don't need to get that
sophisticated.


TIA,

Manuel Ricca

.