User (Legacy) Posted February 28, 2001 Report Share Posted February 28, 2001 I found the following code to work. // TODO: Add your control notification handler code here int horres, verres, gap; long l, t, t2, r, b, b2; CDC MyDC; HDC hDC; CSize size; DOCINFO di; ::ZeroMemory (&di, sizeof(DOCINFO)); di.cbSize = sizeof(DOCINFO); di.lpszDocName = _T("Sample two graphs per page"); CPrintDialog dlg(FALSE, PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_HIDEPRINTTOFILE | PD_NOSELECTION, this); dlg.GetDefaults(); hDC = dlg.GetPrinterDC(); MyDC.Attach(hDC); gap = 42; /* default Map Mode, MM_TEXT, pixels */ horres = MyDC.GetDeviceCaps(HORZRES); verres = MyDC.GetDeviceCaps(VERTRES); l = 2*horres/3; t2 = t = gap; r = horres; b2 = b = (verres / 4); m_pChartFX1->Printer->Orientation = ORIENTATION_PORTRAIT; m_pChartFX2->Printer->Orientation = ORIENTATION_PORTRAIT; if (MyDC.StartDoc(&di) < 0) return; if (MyDC.StartPage() < 0) return; m_pChartFX1->Paint((long)hDC, l, t, r, b, CPAINT_PRINT, 0); // adjust top and bottom for next graph t = b + gap; b = b2 - t2 + t; // save references for next graph t2 = t; b2 = b; m_pChartFX2->Paint((long)hDC, l, t, r, b, CPAINT_PRINT, 0); // adjust top and bottom for next graph t = b + gap; b = b2 - t2 + t; // save references for next graph t2 = t; b2 = b; m_pChartFX3->Paint((long)hDC, l, t, r, b, CPAINT_PRINT, 0); // adjust top and bottom for next graph t = b + gap; b = b2 - t2 + t; // save references for next graph t2 = t; b2 = b; m_pChartFX4->Paint((long)hDC, l, t, r, b, CPAINT_PRINT, 0); MyDC.EndPage(); MyDC.EndDoc(); "Chuck" <chuck.wollaston@wwgsolutions.com> wrote in message news:rQY$mXOnAHA.1804@sfxserver.softwarefx.com... > Does anyone have sample code printing multiple graphs on a page using the > Paint() function in Visual C++? > > TIA > > chuck > > > > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.