|
|
|
|
|
CSftPrintPreview_Main::OnPrintInitialize |
The OnPrintInitialize virtual override is called to initialize print/preview of one or more pages.
C++
virtual void CSftPrintPreview_Main::OnPrintInitialize(
CDC* pDC,
LPSFTPRINTPREVIEW_DRAWINFO lpInfo);
Parameters
pDC
The device context used for page rendering.
lpInfo
A pointer to the SFTPRINTPREVIEW_DRAWINFO structure defining additional information about the current previewing and printing operation.
Comments
The OnPrintInitialize virtual override is called to initialize print/preview of one or more pages. It is called immediately before displaying/printing one or more pages and is followed by one or more calls to OnPrintOnePage and a final call to OnPrintTerminate.
The OnPrintInitialize virtual override is typically used to initialize and allocate resources that are used to render pages.
This function is only used for application-generated output.
Example
C++
void CPreviewPagesView::OnPrintInitialize(CDC* pDC, LPSFTPRINTPREVIEW_DRAWINFO lpInfo)
{
// 10 point font
int height = MulDiv(10, GetDeviceCaps(lpInfo->hDCPrinter, LOGPIXELSY), 72);
m_PrintFont.CreateFont(- height, 0, 0, 0, FW_NORMAL, FALSE, FALSE,
FALSE, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, FF_DONTCARE|DEFAULT_PITCH,
_T("Arial"));
_ASSERT(m_PrintFont.m_hObject);
}
void CPreviewPagesView::OnPrintTerminate(CDC* pDC, LPSFTPRINTPREVIEW_DRAWINFO lpInfo)
{
m_PrintFont.DeleteObject();
}
See Also C/C++ API | C++ Classes | Notifications