Link to home
Start Free TrialLog in
Avatar of davidst98
davidst98

asked on

Resize a WebBrowser control based on the Website page

Hi,

Is there a way to resize a WebBrowser control (which in turn will resize a WinForm or WPF Window) based on a default size of a webpage.   For example if I click on a link in IE it will bring up a pop with a different size and width then my web browser.   I would like to make a quick app that will directly open this pop and will re-size itself to the webpage.   I hope this makes sense.   Thanks.

David
Avatar of Matthew Kelly
Matthew Kelly
Flag of United States of America image

There is no such thing as a default size of a webpage. You would need to know what content piece you were trying to size to on the page which would require knowing exactly what pages you are navigating to and what elements to look for.

Take this EE page for example. You may say, I want it to size so I see only the right and left hand navigation with everything else on either side of it cut off.

So there is a "bodyWrapper" id DIV you could size to, but that is encapsulated in other div containers that are set to 100%.

Web pages are designed to size to the browser, not the other way around. If your WebBrowser control is only setup to go to webpages you control you could do it by getting the width/height of a container object on the page.
Avatar of davidst98
davidst98

ASKER

Hi Matthew,  thanks for the response.  I'm a little confused.  How do pop web pages are able to change the size of the web browser and also remove menu and toolbars?

David
ASKER CERTIFIED SOLUTION
Avatar of Matthew Kelly
Matthew Kelly
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial