GeckoFX WebBrowser page height and width

让人想犯罪 __ 提交于 2019-12-11 00:00:21

问题


Does anyone know how I get the full page height and width in GeckoFX? In the IE WebBrowser object, I can look at WebBrowser.Document.Body.ScrollRectangle. (The objective here is to take a screenshot of the entire page)

Thanks!


回答1:


I'm using Hindle's fork of GeckoFX, and here's how I do it:

var width = _browser.Document.ActiveElement.ScrollWidth;
var height = _browser.Document.ActiveElement.ScrollHeight;

I use this to create thumbnails of the page. Note, this gives us the size taken up by the first page we navigated to, not necessarily the size of the current page. I get around that by using different browser instances for each page I'm thumbnailing.



来源:https://stackoverflow.com/questions/7717454/geckofx-webbrowser-page-height-and-width

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!