Du kannst mal mit folgendem Code spielen (Auszug aus meinem WinSpy)
Delphi-Quellcode:
var
r: TRect;
Element: IHTMLElement;
Delphi-Quellcode:
r.Left := Element.offsetLeft;
r.Top := Element.offsetTop;
repeat
Element := Element.offsetParent;
if Element <> nil then
begin
if (Element.tagName = 'TD') // if parent a table cell,
then
begin
r.Left := r.Left + (Element as IHTMLElement2).ClientLeft; // append cell border width to calcs
r.Top := r.Top + (Element as IHTMLElement2).clientTop;
end;
r.Left := r.Left + Element.offsetLeft;
r.Top := r.Top + Element.offsetTop;
end;
until Element = nil;