mfc控件在ie里面显示不正确的解决方法
2006-05-23 13:16
841 查看
FIX: MFC ActiveX controls paint incorrectly when scrolling the HTML page
View products that this article applies to.function loadTOCNode(){}
Article ID | : | 233391 |
Last Review | : | February 1, 2005 |
Revision | : | 4.0 |
SYMPTOMS
loadTOCNode(1, 'symptoms');An MFC-based windowed ActiveX control on an HTML page paints incorrectly when you scroll the HTML page in the browser. The control appears distorted, showing successively larger bands at the bottom or top as it moves off the visible portion of the HTML page.
In versions of Microsoft Internet Explorer later than version 5, the control may paint correctly. However, child windows on the control still experience the banding effects while scrolling.
Back to the top |
CAUSE
loadTOCNode(1, 'cause');A performance enhancement was added to Internet Explorer 5 to improve the rendering of windowed ActiveX controls by manipulating the available window and clip regions for the control's window. When this code operates on MFC controls, portions of the control's window outside the clip region are invalidated. Because the control's OnDraw cannot draw outside the clip region, these areas show stripes of the background color.
Back to the top |
RESOLUTION
loadTOCNode(1, 'resolution');To resolve this problem, upgrade clients to version 5.01 or later of Internet Explorer.
Note A change was made in Internet Explorer to fix the problem that is described in the following Microsoft Knowledge Base (KB) article:
307978 (http://support.microsoft.com/kb/307978/) FIX: MFC controls in overlapped IFRAMEs receive unnecessary WM_PAINT messages
However, this change reintroduced the problem in Internet Explorer 6 Service Pack 1.
Back to the top |
WORKAROUND
loadTOCNode(1, 'workaround');To work around this problem, use one of the following methods:
• | Repaint the control when the cnscroll event fires, as in the following sample code.[code]<SCRIPT> function workaround() { // "a" is the name of the control. window.document.all.item("a").style.display = "none" window.document.all.item("a").style.display = "" } </SCRIPT> <BODY onscroll="workaround();"> [/code] |
• | If the control class is derived from the COleControl class, it implements a virtual method that is named OnSetObjectRects. You can override this method, as in the following sample code. [code]BOOL CmfcaxCtrl::OnSetObjectRects(LPCRECT lpRectPos, LPCRECT lpRectClip) { return TRUE; } [/code] |
• | Use ATL instead of MFC to develop the ActiveX control. |
[code]// NUMBER_OF_CHILDREN is predefined as the number of child windows // that are hosted on this control // m_Children is a member variable of the CWindowedCtrl class that // stores an array of CWnd references to the child windows on the control. void CWindowedCtrl::OnPaint() { CPaintDC dc(this); // device context for painting<BR/> for(int i = 0 ; i < NUMBER_OF_CHILDREN ; i++) { m_Children[i].RedrawWindow(NULL,NULL,RDW_INVALIDATE | RDW_FRAME); } COleControl::OnPaint(&dc); }
[/code]
Back to the top |
STATUS
loadTOCNode(1, 'status');Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section. This problem was corrected in Internet Explorer 5.01. This problem was reintroduced in Internet Explorer 6 Service Pack 1.
Back to the top |
MORE INFORMATION
loadTOCNode(1, 'moreinformation');This bug does not cause any painting problems for windowless controls.
相关文章推荐
- MFC:文本内容显示到ListBox,顺序不正确的解决方法
- WPF WebBrowser 控件在 x64 机器上显示IE/Flash 错误解决方法
- easyUI的列表控件(datagrid)日期列不能正确显示Json格式数据的解决方法
- iframe 高度显示不正确解决方法 IE
- 在VS2010里MFC对话框中使用OpenGL绘图,添加的控件不显示的一种解决方法
- MFC调用VLC接口在IPC控件显示视频,然后鼠标在视频上绘图解决方法
- MFC CComboBox 添加字符串显示不正确的解决方法
- vc2008中mfc菜单、控件等汉字显示为问号或乱码的解决方法---难者不会,会者不难!
- vc2010中mfc/com菜单、控件等汉字显示为问号或乱码的解决方法
- vc2008中mfc菜单、控件等汉字显示为问号或乱码的解决方法
- easyUI的列表控件(datagrid)日期列不能正确显示的解决方法
- MyEclipse里面项目出现红叉但是又能正确运行的解决方法
- CButton控件:mfc自绘按钮类,1张图片显示多种状态的方法
- CButton控件:mfc自绘按钮类,1张图片显示多种状态的方法
- 关于OCX控件在ie下调用不了接口的解决方法
- jquery用get实现ajax在ie里面刷新不进入后台解决方法
- 桌面不显示IE图标解决方法
- mfc里面 有没有显示图片的列表控件啊
- LoadRunner 12录制脚本,显示无Internet,打不开IE网页的解决方法
- 在servlet里面使用printWriter输出ireport到jsp显示乱码的解决方法