c# - WebBrowser control content width/height -



c# - WebBrowser control content width/height -

i'm having difficulties trying programmitcally determine width , height of webbrowser based on contents of loaded page. need info capture screenshot of webpage.

this occures within button click event

wbny.navigate(new uri("http://www.website.com"), "_self"); wbny.documentcompleted += wbny_documentcompleted;

this document completed code

private void wbny_documentcompleted(object sender, webbrowserdocumentcompletedeventargs e) { if (e.url == wbny.url) { if (wbny.readystate == webbrowserreadystate.complete) { dopagechecks(); } } }

within dopagechecks phone call method

takescreenshot(wbny);

this takescreenshot method

protected void takescreenshot(webbrowser wb) { size pagesize = new size(wb.document.window.size.width,wb.document.window.size.height) }

my screenshot code works fine, i'm showing point i'm trying height , width of webbrowser contents, can take screenshot right dimensions.

i've tried

size pagesize = new size(wb.document.body.scrollrectangle.width,wb.document.body.scrollrectangle.height)

but isn't giving right values.

more specifically, height coming on 0, or ~20px, when real result should closer 800px+

you want actualheight , actualwidth, homecoming rendered height , width of window, want if taking screenshot.

c# webbrowser-control

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -