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.
<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();">
- 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.
BOOL CmfcaxCtrl::OnSetObjectRects(LPCRECT lpRectPos, LPCRECT lpRectClip)
{ return TRUE;
}
- Use ATL instead of MFC to develop the ActiveX
control.
Unfortunately, MFC controls that contain child windows will
still have painting problems in Internet Explorer. You can resolve these problems by
forcing a redraw on all the child windows during handling of the
OnPaint
message. To do this, you must add a message map entry for WM_PAINT to
the
COleControl-derived class. In the
OnPaint handler, use code that is similar to the
following.
// 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);
}