views:

91

answers:

1

I need to display some portion of html in my windows forms application. It's necessary that this html will be displayed without any scrollbars.

I tried to use WebBrowser control for my task, but it lacks of AutoSize property. Is it possible to determine minimal height necessary to display all contents without scrolling somehow?

+1  A: 

Here's a link to a C# WebBrowser wrapper which may do what you need:

http://www.codeproject.com/KB/miscctrl/csEXWB.aspx?msg=2526724

To do what you need, I think you would access the document on the page and then the element you're displaying, and get its height and width properties, and then adjust your WebBrowser control to be a few pixels larger than that. I think the WebBrowser wrapper control in the link can do the first part of this task (get the element's height and width).

MusiGenesis
Thanks for the hint! I wrapped by html into div and now setting height of browser to OffsetRectangle.Height of that div. And this can be done with standard WebBrowser.
Dmitriy Matveev