public Point GetRealOffset(HtmlElement element) { //get element pos Point point = new Point(element.OffsetRectangle.Left, element.OffsetRectangle.Top); //get the parents pos HtmlElement tempElement = element.OffsetParent; while (tempElement != null) { point.X += tempElement.OffsetRectangle.Left; point.Y += tempElement.OffsetRectangle.Top; tempElement = tempElement.OffsetParent; } return point; }
c# webBrowser html element real offset height value
in use!
example
if (span.GetAttribute("className").Contains("remainSMS")) { int remainSMS = Int32.Parse(span.InnerHtml); if (remainSMS > -99999 && remainSMS <= numericUpDown_남은기간.Value) { 발송가능sms가없습니까 = false; webBrowser_관리자.Document.Window.ScrollTo(GetRealOffset(span.Parent.Parent)); break; } }