int nMin,nMax; pListView->GetScrollRange(SB_VERT,&nMin,&nMax); pListView->SetScrollPos(SB_VERT,nMax); 看看这样行不行void GetScrollRange( int nBar, LPINT lpMinPos, LPINT lpMaxPos ) const; Parameters nBar Specifies the scroll bar to examine. The parameter can take one of the following values: SB_HORZ Retrieves the position of the horizontal scroll bar. SB_VERT Retrieves the position of the vertical scroll bar. lpMinPos Points to the integer variable that is to receive the minimum position. lpMaxPos Points to the integer variable that is to receive the maximum position. /********************************/ int SetScrollPos( int nBar, int nPos, BOOL bRedraw = TRUE ); Parameters nBar Specifies the scroll bar to be set. This parameter can be either of the following: SB_HORZ Sets the position of the scroll box in the horizontal scroll bar of the window. SB_VERT Sets the position of the scroll box in the vertical scroll bar of the window. nPos Specifies the new position of the scroll box. It must be within the scrolling range. bRedraw Specifies whether the scroll bar should be repainted to reflect the new scroll-box position. If this parameter is TRUE, the scroll bar is repainted; if FALSE, the scroll bar is not repainted.
这个方法也可以:Example// The pointer to my list view control. extern CListCtrl* pmyListCtrl;// Ensure that the last item is visible. int nCount = pmyListCtrl->GetItemCount(); if (nCount > 0) pmyListCtrl->EnsureVisible(nCount-1, FALSE);
pListView->GetScrollRange(SB_VERT,&nMin,&nMax);
pListView->SetScrollPos(SB_VERT,nMax);
看看这样行不行void GetScrollRange(
int nBar,
LPINT lpMinPos,
LPINT lpMaxPos
) const;
Parameters
nBar
Specifies the scroll bar to examine. The parameter can take one of the following values:
SB_HORZ Retrieves the position of the horizontal scroll bar.
SB_VERT Retrieves the position of the vertical scroll bar.
lpMinPos
Points to the integer variable that is to receive the minimum position.
lpMaxPos
Points to the integer variable that is to receive the maximum position.
/********************************/
int SetScrollPos(
int nBar,
int nPos,
BOOL bRedraw = TRUE
);
Parameters
nBar
Specifies the scroll bar to be set. This parameter can be either of the following:
SB_HORZ Sets the position of the scroll box in the horizontal scroll bar of the window.
SB_VERT Sets the position of the scroll box in the vertical scroll bar of the window.
nPos
Specifies the new position of the scroll box. It must be within the scrolling range.
bRedraw
Specifies whether the scroll bar should be repainted to reflect the new scroll-box position. If this parameter is TRUE, the scroll bar is repainted; if FALSE, the scroll bar is not repainted.
extern CListCtrl* pmyListCtrl;// Ensure that the last item is visible.
int nCount = pmyListCtrl->GetItemCount();
if (nCount > 0)
pmyListCtrl->EnsureVisible(nCount-1, FALSE);