<p>I have a WinForms program written on .NET 2 which hosts a webbrowser control and renders asp.net pages from a known server.</p>

<p>I would like to be able to drag, say, a tree node from a treeview in my winforms app into a specific location in the hosted web page and have it trigger a javascript event there.
Currently, I can implement the <code>IDocHostUIHandler</code> interface and getting drag\drop events on the browser control, then call <code>Navigate("javascript:fire_event(...)")</code> on the control to execute a script on the page. However, I want this to work only when I drop data on a <em>specific</em> part of the page.</p>

<p>One solution, I suppose, would be to bite the bullet and write a custom browser plugin in the form of an activex control, embed that in the location I want to drop to and let that implement the needed drag\drop interfaces.</p>

<p>Would that work?
Is there a cleaner approach? Can I take advantage of the fact that the browser control is hosted in my app and provide some further level of interaction?</p>

[{'answer_id': 5284, 'author': 'Justin Walgran', 'author_id': 173, 'author_profile': 'https://Stackoverflow.com/users/173', 'pm_score': 2, 'selected': False, 'text': '<p>Take a look at the <a href="http://browserplus.yahoo.com/" rel="nofollow noreferrer">BrowserPlus</a> project at Yahoo.</p>\n\n<p>It looks like they have built a toolkit so that you don\'t have to do the gritty work of writing the browser plugin yourself.</p>\n'}, {'answer_id': 29542, 'author': 'Ben Childs', 'author_id': 2925, 'author_profile': 'https://Stackoverflow.com/users/2925', 'pm_score': 1, 'selected': False, 'text': "<p>If you can find out the on screen position of the part of the page you are interested in, you could compare this with the position of the mouse when you receive the drop event. I'm not sure how practical this is if you can get the info out of the DOM or whatnot.</p>\n\n<p>As an alternative could you implement the mouse events on the bit of the page using javascript?</p>\n"}]
['https://Stackoverflow.com/questions/4849', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/618/']