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

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -