Is it possible to get the location (relative to the screen) of a picture or other html element inside the webbrowser control?
This is what i've tried, I found it online.
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
Thanks

New Topic/Question
Reply



MultiQuote





|