How do I render the scrollable regions of a canvas with IViewObject::Draw?
Asked Answered
M

2

3

I've been trying to render the entire canvas in an IWebBrowser2 control to a bitmap. IViewObject::Draw seems to be the most promising approach, but I can't get it to render anything that would requires a scroll to show. While I could automate the scrolling and stitch the images together, this would look weird with any fixed position elements. Is this even doable?

Additionally, I've tried to set the controller's size to one that would allow the entire contents to display without needing to scroll, but Windows caps the max size to the current screen resolution, so that only gets me partially there.

Any help would be much appreciated. I'm currently doing this in the context of Win7 and IE8, but I don't think that should matter much.

Mineral answered 29/1, 2010 at 2:57 Comment(0)
M
2

Sorry it took so long for me to follow up with the answer to this.

I wrote up an article detailing how to trick Windows into allowing you to resize a window larger than the virtual screen resolution, allowing functions like PrintWindow or IViewObject::Draw to capture the entire client area (i.e., the browser canvas).

http://nirvdrum.com/2010/03/25/how-to-take-full-page-or-full-canvas-screenshots-in-windows.html

An actual implementation of the technique can be found in my SnapsIE repository on GitHub (username: nirvdrum). Unfortunately I don't have enough karma to post two hyperlinks. The repository is linked from the article though.

Mineral answered 25/3, 2010 at 13:48 Comment(0)
O
0

It is very likely an IE optimisation that avoid to draw more than required. You might be able to scroll the window and call IViewObject::Draw in a loop without any animation occuring ?

I'm surprised that Windows caps the max size to the current screen resolution. Are you sure about that ?

Ouachita answered 4/2, 2010 at 9:39 Comment(1)
Yeah, I'm sure about it. I managed to solve it by installing a Windows hook for CALL_WND_PROC and from there injecting a new message processor. In that processor I could modify the WM_GETMINMAXINFO message to change the max size.Mineral

© 2022 - 2024 — McMap. All rights reserved.