CView::OnPrepareDC

virtual void OnPrepareDC( CDC* pDC, CPrintInfo* pInfo = NULL );

Parameters

pDC

Points to the device context to be used for rendering an image of the document.

pInfo

Points to a CPrintInfo structure that describes the current print job if OnPrepareDC is being called for printing or print preview; the m_nCurPage member specifies the page about to be printed. This parameter is NULL if OnPrepareDC is being called for screen display.

Remarks

Called by the framework before the OnDraw member function is called for screen display and before the OnPrint member function is called for each page during printing or print preview. The default implementation of this function does nothing if the function is called for screen display. However, this function is overridden in derived classes, such as CScrollView, to adjust attributes of the device context; consequently, you should always call the base class implementation at the beginning of your override.

If the function is called for printing, the default implementation examines the page information stored in the pInfo parameter. If the length of the document has not been specified, OnPrepareDC assumes the document to be one page long and stops the print loop after one page has been printed. The function stops the print loop by setting the m_bContinuePrinting member of the structure to FALSE.

Override OnPrepareDC for any of the following reasons:

Call the base class version of OnPrepareDC at the beginning of your override.

CView OverviewClass MembersHierarchy Chart

See Also   CDC::Escape, CPrintInfo, CView::OnBeginPrinting, CView::OnDraw, CView::OnPreparePrinting, CView::OnPrint