I was wondering if its possible to get the absolute position of specific HTML element I have loaded in webbrowser control with C#.
I tried almost all of the options that .Net provides..
none of them give me the correct position. all of them give me 0 for Y coordinate.. the element is definitely is not in 0..
does anybody have any solution or idea to solve this?
here is the solution I got so far:
// set the size of our web browser to be the same size as the image
int width, height;
width = webBrowser1.Document.Images[0].ClientRectangle.Width;
height = webBrowser1.Document.Images[0].ClientRectangle.Height;
now this code works perfectly.. but there is an issue with calculating the offsets. I need to calculate the offsetparent of the element then calculate the offsetparent of the offsetparent etc.. I need to do that dynamically not adding it one by one.. I don’t know how to do that. any ideas?
EDIT:
here is my last and final version and it works with any html element it will find the absolute position of any element I want..
then use the position with:
done!