User (Legacy) Posted July 10, 2003 Report Share Posted July 10, 2003 I am using change MapMode, and I show Screen correct. But printing not correct. because chart font is very small. I set logigal coordinates , and set font , and set Chart Information. But this failuer.. why this it? print result. chart in text size then small "Font Test"(this test text ) ///////////////////////////// init //////////////////////////////////////////////////// m_pChartFX.CreateInstance(__uuidof(ChartFX)); .... .... init chart information .... .... ///////////////////////////////// Change CDC Attrib.. OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) { // TODO: Add your specialized code here and/or call the base class pDC->SetMapMode(MM_ANISOTROPIC); pDC->SetWindowExt(m_lsize); // in logical coordinates CPoint ptVpOrg=CPoint(0,0); if (!pDC->IsPrinting()) { pDC->SetViewportExt(m_lsize.cx,m_lsize.cy); // in device coordinates // by default shift viewport origin in negative direction of scroll ASSERT(pDC->GetWindowOrg() == CPoint(0,0)); ptVpOrg = -GetDeviceScrollPosition(); pDC->SetViewportExt(printSize); } // Set the new origin pDC->SetViewportOrg(ptVpOrg); CView::OnPrepareDC(pDC, pInfo); } ///////////////////////////////// do WM_PAINT Message ///////////////// if (font.CreatePointFontIndirect(&m_lgfont,pDC)) { oldfont=(CFont*)pDC->SelectObject(&font); //All Font change Font... for (int i=0;i<=12;i++) m_pChartFX->HFont[(enum CfxFont)i]=(LONG)(HFONT)font; if (pDC->IsPrinting()) { m_pChartFX->Printer->TopMargin=0; m_pChartFX->Printer->LeftMargin=0; m_pChartFX->Printer->BottomMargin=0; m_pChartFX->Printer->TopMargin=0; m_pChartFX->Printer->UsePrinterResolution=FALSE; m_pChartFX->Printer->hDC=(LONG)pDC->GetSafeHdc(); } m_pChartFX->Paint((LONG)pDC->GetSafeHdc(),rect.left,rect.top,rect.right,rect .bottom,CPAINT_PRINT,NULL); pDC->TextOut(rect.left,rect.top,"Font Test"); } //////////////////////////// Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.