CView::OnPrint

virtual void OnPrint( CDC* pDC, CPrintInfo* pInfo );

Parameters

pDC

Points to the printer device context.

pInfo

Points to a CPrintInfo structure that describes the current print job.

Remarks

Called by the framework to print or preview a page of the document. For each page being printed, the framework calls this function immediately after calling the OnPrepareDC member function. The page being printed is specified by the m_nCurPage member of the CPrintInfo structure that pInfo points to. The default implementation calls the OnDraw member function and passes it the printer device context.

Override this function for any of the following reasons:

Note that the m_rectDraw member of the pInfo parameter describes the printable area of the page in logical units.

Do not call OnPrepareDC in your override of OnPrint; the framework calls OnPrepareDC automatically before calling OnPrint.

Example

The following is a skeleton for an overridden OnPrint function:

void CMyView::OnPrint( CDC *pDC, CPrintInfo *pInfo )
{
   // Print headers and/or footers, if desired.
   // Find portion of document corresponding to pInfo->m_nCurPage.
   OnDraw( pDC );
}

For another example, see CRichEditView::PrintInsideRect.

CView OverviewClass MembersHierarchy Chart

See Also   CView::OnBeginPrinting, CView::OnEndPrinting, CView::OnPrepareDC, CView::OnDraw