如何在 IE9 中重绘/重绘指向 DOM 中图像元素的 IHTMLElement?

发布于 2024-11-01 00:24:22 字数 460 浏览 4 评论 0原文

我有一个有效的 IHTMLElement 对象,它指向 IE9 中的图像。图像数据最近通过IDirectDrawSurface更新。我正在尝试找到一种方法来强制 IE9 在更新图像数据后重新绘制 DOM 中的图像。谁能指导我一种强制重新绘制以这种方式更新的图像的方法?

我尝试过的方法:

HRESULT ret = pElement->get_style(&pStyle);
pStyle->put_visibility(L"hidden");
pStyle->put_visibility(L"visible");
// Or
pStyle->put_display(L"none");
pStyle->put_display(L"block");

感谢您的宝贵时间,任何提示将不胜感激。

-将要

I've got a valid IHTMLElement object that points to an image in IE9. The image data was recently updated via an IDirectDrawSurface. I'm trying to find a way to force IE9 to repaint the image in the DOM after I update the image data. Could anyone please direct me to a method of forcing a repaint of an image that has been updated in this fasion?

Approaches I've tried:

HRESULT ret = pElement->get_style(&pStyle);
pStyle->put_visibility(L"hidden");
pStyle->put_visibility(L"visible");
// Or
pStyle->put_display(L"none");
pStyle->put_display(L"block");

Thanks for your time, and any tips would be greatly appreciated.

-Will

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怪我闹别瞎闹 2024-11-08 00:24:22

您是否尝试过重置元素的 src ?据我所知,如果您设置已经存在的相同 src,IE 将不会执行任何操作,但看起来它可能会被欺骗;

    IHTMLImgElement pImg;
    m_pElement->QueryInterface(IID_IHTMLImgElement, (void**)(&pImg));
    _bstr_t bstrOriginalSrc;
    pImg->get_src(bstrOriginalSrc.GetAddress());
    pImg->put_src(L""); //Trick to avoid setting the same src as already present
    pImg->put_src(bstrOriginalSrc);

Have you tried resetting the src of the element? From what I can see, IE won't do anything if you set the same src that is already present, but looks like it can be tricked;

    IHTMLImgElement pImg;
    m_pElement->QueryInterface(IID_IHTMLImgElement, (void**)(&pImg));
    _bstr_t bstrOriginalSrc;
    pImg->get_src(bstrOriginalSrc.GetAddress());
    pImg->put_src(L""); //Trick to avoid setting the same src as already present
    pImg->put_src(bstrOriginalSrc);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文