Printing the control


void CIvSceneListCtrl::Print(CDC* pDC, CPrintInfo* pInfo) {

CClientDC dcScreen(NULL);
pDC->SetMapMode(MM_ANISOTROPIC);
//map 1 screen logical inch to 1 printer.
pDC>SetWindowExt( dcScreen.
GetDeviceCaps(LOGPIXELSX),dcScreen.
GetDeviceCaps(LOGPIXELSX));
pDC->SetViewportExt( pDC->GetDeviceCaps(LOGPIXELSX),
pDC->GetDeviceCaps(LOGPIXELSX));

CPen pen(PS_SOLID,1,RGB(0,0,0));
CPen* OldPen = pDC->SelectObject(&pen);

CHeaderCtrl* pHeader = (CHeaderCtrl*) GetDlgItem(0);

if (pHeader) pHeader->SendMessage(WM_PAINT,(WPARAM)pDC->m_hDC);
SendMessage(WM_PAINT,(WPARAM)pDC->m_hDC);

pDC->SelectObject(OldPen);
}

More by Author

Must Read