Fit WebHTMLViewer to content

How can i fit the height of a WebHTMLViewer to the size of the content?

Any idea? I build a page with a lot of small WebHTMLViewers. I try to elminate the number of scrollbars.

Also looking for a solution to this… best I could come up with is


but that only works on OSX

I have no idea how to fit the height of a WebHTMLViewer to the height of the content, but if you want to display without scrollbars :

  • Add a Container control to the project
  • On it, place a WebHTMLViewer larger than the CC enough to mask the scrollbar if it comes
  • Place an instance of the CC on your Webpage, and set its ScrollBarVisible property in the inspector to Never

Instances of the Container Control will never show any scrollbar on any site.

Don’t forget to prefix all properties and methods of the WebHTMLViewer with the name of the ContainerControl instance.

The MBS functions are for desktop apps only.

Sorry didn’t notice this was on the web forum when I replied. I am talking about a desktop app - scaling a website in the WebKit so it fits in a small window.

It’s really not that easy to get the intrinsic height of the content in a WebHTMLViewer. You would probably be better off using a WebSDK control for this. Remember… Each of the browsers render things slightly differently, so the heights would vary. Are you also expecting the controls around these html areas to move out of the way too?

Both Studio Stable’s Web Essentials and Taylor Design’s Web Custom Controls have controls that can do this.