Jump to content
Software FX Community

Re: Printing multiple graphs on a page in C++


User (Legacy)
 Share

Recommended Posts

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...