void CSketcherView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) { CScrollView::OnPrepareDC(pDC, pInfo); CSketcherDoc* pDoc = GetDocument(); pDC->SetMapMode(MM_ANISOTROPIC); CSize DocSize = pDoc->GetDocSize(); // y_extent must be negative because we wan // notional MM_LOENGLISH DocSize.cy = -DocSize.cy; pDC->SetWindowExt(DocSize); // Get number of pixels per inch in x and y int xLogPixels = pDC->GetDeviceCaps(LOGPIXELSX); int yLogPixels = pDC->GetDeviceCaps(LOGPIXELSY); // Calculate the viewport extent in x and y int xExtent = DocSize.cx * m_Scale * xLogPixels/100; int yExtent = DocSize.cy * m_Scale * yLogPixels/100; pDC->SetViewportExt( xExtent, -yExtent ); }