IE9 Web 控件未在 CHtmlView 中重绘自身
这是一个旧的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,谜团解开了。看来单击选项卡也会激活代码中其他位置的拖动循环,并且在开始拖动之前执行以下代码以重绘刚刚激活的选项卡:
然而,该代码似乎完全混淆了 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:
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).