有什么方法可以将Webbrowser内容绘制到特定的DC吗?
这些天,我尝试在程序中创建一个隐藏的 WebBrowser 控件,并使用 IViewObject 界面绘制到我的自定义 DC。
结果很好,我得到了我想要的所有内容,但是Draw速度令人无法接受,尤其是一些包含Flash对象的复杂网页,每次Draw to DC花费超过100毫秒。所以我画的flash物体并不光滑。
有没有一种快速的方法将控件绘制到我的特定 DC?
我的代码 sinpet 是这样的:
//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);
感谢您阅读这个问题。
等待您的答复~
These days, I tries to create a hiden WebBrowser control in my program, and Using the IViewObject interface draw to my custom DC.
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.
Is there a fast way to draw the control to my a specific DC?
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);
Thank you for reading this question.
Waiting for your answers~
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没有其他方法可以做到这一点。您正在使用的所有组件(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.
试试这个:
http://sourceforge.net/projects/wke/
Try this:
http://sourceforge.net/projects/wke/