ViewSize example for Delphi
var
nSize: Integer;
nFirst: Integer;
nLast: Integer;
nCols: Integer;
nCount: Integer;
begin
//NOTE: assume scroll style = SCROLLSTYLE_VERTICAL
//get the view size
nSize:= LEADImgList1.ViewSize;
//get the first visible item
nFirst:= LEADImgList1.FirstVisibleItem;
//get the column count
nCols:= LEADImgList1.ColumnCount;
//calculate the index of last visible item
nLast:= nFirst + (nSize * nCols) - 1; //0 based index
nCount:= LEADImgList1.Count;
if (nLast > nCount - 1) Then
nLast:= nCount - 1;
end;