IE9 Web控件无法在CHtmlView中重绘自身 [英] IE9 web control not redrawing itself in CHtmlView

查看:98
本文介绍了IE9 Web控件无法在CHtmlView中重绘自身的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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();

现在,对于所有类型的CView-s,包括从CHtmlView派生的CView-s,这一切都可以很好地工作,但是当计算机上安装IE9时,它就停止了工作(IE8运行良好).在将选项卡与CHtmlView来回切换时,Web浏览器控件不会重新绘制自身,并且以前的选项卡内容仍然可见.拖动时在该区域上的计算器窗口中,内容以不整齐的方式重新出现,表明该控件只是不了解该窗口内容已失效,需要重新绘制.添加newview-> Invalidate()调用无济于事,可能我应该更深入地研究CHtmlView并将某些消息直接发送到Web浏览器控件?

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)

TIA, Paavo

推荐答案

好,谜底解决了.看来,单击选项卡还激活了代码中其他位置的拖动循环,并且在开始拖动之前,执行了以下代码以重新绘制刚刚激活的选项卡:

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);
    }

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

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).

这篇关于IE9 Web控件无法在CHtmlView中重绘自身的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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