IHTMLElementRender opacity
June 9th, 2006
Using IHTMLElementRender::DrawToDC is the wrong way to draw the contents of an webpage to a device drawing context. The reason why the IHTMLElementRender interface is not good is because it does not draw opacity or transpancy that might be visible in a web page. Instead it is best to query the IViewObject interface from the IHTMLDocument2 interface and call the function Draw.
BAD
IHTMLDocument2 — IHTMLElement – IHTMLElementRender::DrawToDC.
GOOD
IHTMLDocument2 – IViewObject::Draw using DVASPECT_DOCPRINT
One thing that is noteworthy is that the call to IViewObject::Draw fails if you implement DISPID_BEFORENAVIGATE2.
You can also use OleDraw instead of IViewObject::Draw and pass OleDraw the IHTMLDocument2 interface.








August 14th, 2007 at 12:31 pm
I don’t suppose you can help me figure out how to draw an HTML page “into” an Enhanced Metafile using VB 6 ?
August 30th, 2007 at 11:39 am
YOU A GENIUS!!!!
May 25th, 2008 at 7:20 pm
[...] it and that’s why my image was missing some parts. I’ve found the solution from an old post from Nathan Moinvaziri. So, I implemented his easy solution that is to use IViewObject instead of IHTMLElementRender… [...]