ViewSize example for C++ 5 and later
int nSize;
int nFirst;
int nLast;
int nCols;
int nCount;
//NOTE: assume scroll style = SCROLLSTYLE_VERTICAL
//get the view size
nSize = m_LEADRasterImgList1.GetViewSize();
//get the first visible item
nFirst = m_LEADRasterImgList1.GetFirstVisibleItem();
//get the column count
nCols = m_LEADRasterImgList1.GetColumnCount();
//calculate the index of last visible item
nLast = nFirst + (nSize * nCols) - 1; //0 based index
nCount = m_LEADRasterImgList1.GetCount();
if (nLast > nCount - 1)
nLast = nCount - 1;
CString out;
out.Format(TEXT("nSize = %d\nnFirst = %d\nnLast = %d\nnCols = %d\nnCount = %d\n"), nSize, nFirst, nLast, nCols, nCount);
AfxMessageBox(out);