User (Legacy) Posted August 20, 1999 Report Share Posted August 20, 1999 Good Afternoon! I have a new problem. I am trying to print out several charts at the same time on the same page (4 for right now). I am using the code below. I am also using a chart structure that consists of x1, x2, y1, y2 which is the location of the chart if the screen was 100 pixels wide (this helps with scaling and movement of charts). The problem is that the first chart prints correctly, but none of the other charts print. I've tried several different ways of wording the for loop and nothing seems to work. Is something wrong here? PRINTDLG lppd; lppd.hDevMode = NULL; lppd.hDevNames = NULL; lppd.lStructSize = sizeof(PRINTDLG); lppd.hwndOwner = NULL; lppd.Flags = PD_RETURNDC; lppd.nCopies = 1; lppd.nFromPage = 0xFFFF; lppd.nToPage = 0xFFFF; lppd.nMinPage = 1; lppd.nMaxPage = 0xFFFF; if (PrintDlg(&lppd) == TRUE) { int rv; int width, height; DOCINFO di; di.cbSize = sizeof(DOCINFO); di.lpszDocName = "ChartFX Print"; di.lpszOutput = NULL; di.lpszDatatype = NULL; di.fwType = DI_ROPS_READ_DESTINATION; rv = StartDoc(lppd.hDC, &di); if (rv == SP_ERROR) { /*error*/ } rv = StartPage(lppd.hDC); if (rv == SP_ERROR) { /*error*/ } width = GetDeviceCaps(lppd.hDC, HORZRES); height = GetDeviceCaps(lppd.hDC, VERTRES); for (int i = 0; i < 4; i++) { m_pChartFX[i]->Paint((long)lppd.hDC, (width * (chart[i].x1 / 100)), (height * (chart[i].y1 / 100)), (width * ((chart[i].y2 - plots.chart[i].y1) / 100)), (height * ((chart[i].x2 - plots.chart[i].x1) / 100)), CPAINT_PRINT, 0); } rv = EndPage(lppd.hDC); if (rv == SP_ERROR) { /*error*/ } rv = EndDoc(lppd.hDC); if (rv == SP_ERROR) { /*error*/ } DeleteDC(lppd.hDC); } Thank you in advance. -- Joshua Eanes Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.