I am trying to experiment some with the WebBrowser in Win Forms in C# Just I was almost done when I noticed that I could not access the MousePosition values for some reason. I have looked around and I have understood that that function is not available in the WebBrowser component… My question is this… Is there any way to get through to the underlying form to get the position of the mouse? Or do I need to do it another way completely or is it simply impossible?
My problems would be solved if I somehow could get the values so I could do something that does this:
textbox1.Text = MousePosition.X + ":" + MousePosition.Y;
Since then I could see where my mouse was and also start playing with the possibilities. Hopefully you understand what I want!
You will have to use Javascript in order to pull the mouse position. If you want to send that information to the server you can do so via Ajax or form posts.
Here’s some information on using AJAX to send data: http://weblogs.asp.net/craigshoemaker/archive/2008/11/07/using-jquery-to-call-asp-net-ajax-page-methods-by-example.aspx