void CFreezeLastRowListCtrl::FreezeLastItem()
{
if (m_AddedIndex != -1)
{
DeleteItem(m_AddedIndex);
}
int TopIndex = GetTopIndex();
int NumPerPage = GetCountPerPage();
m_AddedIndex = TopIndex + NumPerPage - 1;
if (m_AddedIndex < GetItemCount()-1)
{
CString Text = GetItemText(GetItemCount()-1,0);
InsertItem(m_AddedIndex,Text);
}
else
{
m_AddedIndex = -1;
}
}
void CFreezeLastRowListCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar*
pScrollBar)
{
SetRedraw(FALSE);
int nOldPos = GetScrollPos(SB_VERT);
CListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
nPos = GetScrollPos(SB_VERT);
if (SB_ENDSCROLL == nSBCode || nOldPos == nPos)
{
SetRedraw(TRUE);
return;
}
FreezeLastItem();
SetRedraw(TRUE);
}
楼主解决了吗?能不能给我说下,QQ951107618
加你q说吧!