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
Thank you, it works like a charm. I had to rewrite it as VB, and just want to share the solution:
Function GetXOffSet(ByVal elem As HtmlElement) As Integer
Dim xPos As Integer = elem.OffsetRectangle.Left
Dim tElm As HtmlElement = elem.OffsetParent
Dim trig As Boolean = False
While Not trig
Try
xPos += tElm.OffsetRectangle.Left
tElm = tElm.OffsetParent
Catch ex As Exception
trig = True
End Try
End While
Return xPos
End Function
Function GetYOffSet(ByVal elem As HtmlElement) As Integer
Dim yPos As Integer = elem.OffsetRectangle.Top
Dim tElm As HtmlElement = elem.OffsetParent
Dim trig As Boolean = False
While Not trig
Try
yPos += tElm.OffsetRectangle.Top
tElm = tElm.OffsetParent
Catch ex As Exception
trig = True
End Try
End While
Return yPos
End Function