有没有办法将 Webbrowser 内容绘制到特定的 DC? [英] Is there any way to draw Webbrowser content to a specific DC?

查看:17
本文介绍了有没有办法将 Webbrowser 内容绘制到特定的 DC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这些天,我尝试在我的程序中创建一个隐藏的 WebBrowser 控件,并使用 IViewObject 接口绘制到我的自定义 DC.

These days, I tries to create a hiden WebBrowser control in my program, and Using the IViewObject interface draw to my custom DC.

结果很好,我得到了我想要的所有内容,但是Draw速度无法接受,尤其是一些包含Flash对象的复杂网页,每次Draw to DC花费超过100毫秒.所以我画的flash对象不流畅.

The result is fine, I got All the content I want, but the Draw speed is unacceptable, especially some complex web pages which contains Flash objects, Each Draw to DC cost more than 100 ms. So the flash object I drew is not smooth.

有没有一种快速的方法可以将控件绘制到我的特定 DC?

我的代码sinpet是这样的:

my code sinpet is like this:

//hCompDc is a CompatibleDC which select a CompatibleBitmap.
RECTL imageRect = {0, 0, nWidth, nHeight};
pHtmlDocument2->QueryInterface(IID_IViewObject, (void **)&pViewObject);
pViewObject->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL, hCompDc, NULL, &imageRect, NULL, 0);

感谢您阅读此问题.

等待你的回答~

推荐答案

没有其他方法可以做到这一点.您使用的任何组件(IE、Flash 等)都不是为这种方式使用而设计的.如果绘制时间是一个问题,您必须在单独的线程上进行并同步.

There is no other way to do this. None of the components you're using--IE, Flash, etc--were designed to be used this way. If draw time is an issue, you have to do it on a separate thread and synchronize.

这篇关于有没有办法将 Webbrowser 内容绘制到特定的 DC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆