天天看點

關于 ActiveX控件在IE浏覽器中滾動條失效的處理方法

 将acitvex   插入到IE   裡面後,拉動滾動條,當acitvex   控件有部分被IE   覆寫後,再拖回原來位置,橫向的滾動條無法拖動.

這個問題是因為acitvex 控件在IE中沒有被重畫引起的.

解決思路:

(1)從html的js腳本出發:隻要使得acitvex  閃動一下

<SCRIPT>

function doScroll()

{

// "objectEditor" is the name of the control.

document.getElementById("objectEditor").style.display = "none";

  document.getElementById("objectEditor").style.display ="";}

</SCRIPT>

<BODY οnscrοll="doScroll();">

(2)從activex控件内部重畫機制出發: onPaint中

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

}

引用處:

http://support.microsoft.com/kb/233391