使用ScrollWindowEx时出现比较明显的拖滞现象,怎么处理。
在拖动滚动条时,页面出现了拖影,应该怎么处理呀,
看系统内即使文件很多也没有这现象呢。?
void C2MSetting::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
int nDelta = 0;
int nMaxPos = m_rcOriginalRect.Height() - m_nCurHeight;
switch (nSBCode)
{
case SB_LINEDOWN:
if (m_nScrollPos > = nMaxPos)
return;
nDelta = min(max(nMaxPos/20,5),nMaxPos-m_nScrollPos);
break;
case SB_LINEUP:
if (m_nScrollPos <= 0)
return;
nDelta = -min(max(nMaxPos/20,5),m_nScrollPos);
break;
case SB_PAGEDOWN:
if (m_nScrollPos > = nMaxPos)
return;
nDelta = min(max(nMaxPos/10,5),nMaxPos-m_nScrollPos);
break;
case SB_THUMBTRACK:
case SB_THUMBPOSITION:
nDelta = (int)nPos - m_nScrollPos;
break;
case SB_PAGEUP:
if (m_nScrollPos <= 0)
return;
nDelta = -min(max(nMaxPos/10,5),m_nScrollPos);
break;
case 8:
m_nScrollPos += nDelta;
break;
default:
return;
}
m_nScrollPos += nDelta;
SetScrollPos(SB_VERT,m_nScrollPos,TRUE);
ScrollWindowEx(0,-nDelta,NULL,NULL,NULL,NULL,SW_SCROLLCHILDREN);
CDialog::OnVScroll(nSBCode, nPos, pScrollBar);
}
[解决办法]
0