Is there any way to detect the contents height/width in the WebBrowser control? I'd like to save the contents to an image but only at the size of the actual contents.
Thank you in advance.
Is there any way to detect the contents height/width in the WebBrowser control? I'd like to save the contents to an image but only at the size of the actual contents.
Thank you in advance.
I believe you can get it from the following property:
myWebBrowser.Document.ScrollRectangle.Size;
Being a System.Drawing.Size
object.
You can using a Golden section search to find the minimal window size large enough to contain the document, but it is a CPU-intensive task.