IE9 Web 控件未在 CHtmlView 中重绘自身

发布于 2024-12-03 15:39:18 字数 555 浏览 0 评论 0原文

这是一个旧的 MFC 应用程序,它实现了一些选项卡式框架窗口。框架中任何时候都只显示一个 CView,当切换选项卡时,以下代码用于隐藏旧选项卡内容并显示新选项卡内容:

oldview->EnableWindow(FALSE);
oldview->ShowWindow(SW_HIDE);
newview->EnableWindow(TRUE);
newview->ShowWindow(SW_SHOW);
newview->SetFocus();

现在,这一切都适用于任何类型的 CView,包括 CHtmlView 派生的 CView ,但在计算机上安装IE9后停止工作(IE8工作正常)。当在 CHtmlView 之间切换选项卡时,Web 浏览器控件不会重绘自身,并且之前的选项卡内容仍然可见。例如,当在该区域上拖动计算器窗口时,内容会以参差不齐的方式重新出现,这表明控件不知道窗口内容已无效并需要重新绘制。添加 newview->Invalidate() 调用没有帮助,也许我应该深入研究 CHtmlView 并直接向 Web 浏览器控件发送一些消息?

TIA, 帕沃

This is an old MFC application which implements some tabbed frame windows. Only one CView is shown at any time in the frame, when switching tabs the following code is used to hide the old tab content and display the new one:

oldview->EnableWindow(FALSE);
oldview->ShowWindow(SW_HIDE);
newview->EnableWindow(TRUE);
newview->ShowWindow(SW_SHOW);
newview->SetFocus();

Now this all worked nicely for any kind of CView-s, including CHtmlView-derived ones, but stopped working when IE9 was installed on the computer (IE8 worked fine). When switching tabs from and back to a CHtmlView, the web browser control does not redraw itself and the previous tab content remains visible. When dragging e.g. a calculator window over that area, the content reappears in a ragged manner, indicating that the control just did not understand the window content was invalidated and needs to be redrawn. Adding a newview->Invalidate() call does not help, probably I should dig deeper in the CHtmlView and send some message to the web browser control directly?

TIA,
Paavo

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

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

发布评论

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

评论(1

白馒头 2024-12-10 15:39:18

好吧,谜团解开了。看来单击选项卡也会激活代码中其他位置的拖动循环,并且在开始拖动之前执行以下代码以重绘刚刚激活的选项卡:

MSG msg;  
while (::PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_NOREMOVE))
    {
        if (!::GetMessage(&msg, NULL, WM_PAINT, WM_PAINT))
            return;
        DispatchMessage(&msg);
    }

然而,该代码似乎完全混淆了 IE9 Web 浏览器控件。删除此代码后,重绘效果很好(并且我必须以其他方式解决拖动行为)。

OK, mystery solved. It appeared that clicking on the tab also activated a drag loop elsewhere in the code, and before starting the drag the following code was executed for redrawing the just activated tab:

MSG msg;  
while (::PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_NOREMOVE))
    {
        if (!::GetMessage(&msg, NULL, WM_PAINT, WM_PAINT))
            return;
        DispatchMessage(&msg);
    }

It seems however that this code totally confused the IE9 web browser control. After deleting this code the redraw works nicely (and I have to solve the dragging behavior in some other way).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文