Scrollheight Not Accurate
- From: Peter Carlson <peter@xxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 19 Jan 2007 16:48:12 -0700
I am hosting a webbrowser ctrl and using the below code to render to a bitmap. For a large page we normally resize the wndow, then call Draw. However for an iframe (sample at http://www.howudodat.com/frame.html) the scrollHeight is being returned incorrectly. Any ideas?
Peter
CImage * CWndBrowser::GetAsBmp()
{
CRect r; GetClientRect(r);
CImage *img = NULL;
IHTMLDocument2 *document = GetDoc();
if (document) {
CComPtr<IHTMLElement> Element;
document->get_body(&Element);
CComQIPtr<IHTMLElement2> Element2(Element);
long h, w;
if (Element2 != NULL) {
Element2->get_scrollHeight(&h);
Element2->get_scrollWidth(&w);
h+= 25; w+= 25;
}
ResizeClient(w,h);
CComQIPtr<IViewObject2>View(document);
if (View != NULL) {
img = new CImage;
img->Create(w, h, 24);
CDCHandle dc (img->GetDC());
dc.FillSolidRect(0,0,w,h,RGB(255,255,255));
RECTL r = {0,0,w, h};
View->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL, dc, &r, NULL, NULL, NULL);
}
document->Release();
}
ResizeClient(r.Width(), r.Height());
return img;
}
.
- Follow-Ups:
- Re: Scrollheight Not Accurate
- From: Igor Tandetnik
- Re: Scrollheight Not Accurate
- Prev by Date: Re: URI with anchor tag (#) does not work with IE 7 using WebBrowser
- Next by Date: Re: Scrollheight Not Accurate
- Previous by thread: URI with anchor tag (#) does not work with IE 7 using WebBrowser
- Next by thread: Re: Scrollheight Not Accurate
- Index(es):
Relevant Pages
|
Loading