Re: print/print preview paging.
I TRACE the pInfo->m_nCurPage. When I click 'Next Page' in Print Preview,
pInfo->m_nCurPage is 1,2,3,...13. It's correct. But it only display the first
page. The code is as the following:
void CArclabsView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal (4000, 100000);
CSize sizePage (sizeTotal.cx/2, sizeTotal.cy/10);
CSize sizeLine (sizeTotal.cx/2, sizeTotal.cy/100);
SetScrollSizes(MM_TEXT, sizeTotal, sizePage, sizeLine);
}
void CArclabsView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
int i, nStart, nEnd, nPage;
CArclabsDoc* pDoc = GetDocument();
nPage = pInfo->m_nCurPage ;
nStart = (nPage -1) * CArclabsDoc::nLinesPerPage;
nEnd = nStart + CArclabsDoc::nLinesPerPage;
for (i = nStart; i < nEnd; i++)
{
if (i > pDoc->m_stringArray.GetUpperBound ())
break;
TRACE("%s\n",pDoc->m_stringArray[i]);
pDC->TextOut (20, i * 100, pDoc->m_stringArray[i]);
}
//CScrollView::OnPrint(pDC, pInfo);
}
The output of TRACE for the string array is correct, but no output in Print
Preview.