Any suggestions?
Thanks in advance,
Ryan Wagner
////////////////
// Code excerpt
//
CPrintDialog dlg(FALSE, PD_ALLPAGES | PD_RETURNDC |
PD_NOSELECTION | PD_HIDEPRINTTOFILE | PD_NOPAGENUMS,
this);
dlg.m_pd.nCopies = 1;
dlg.m_pd.hDevMode = NULL;
dlg.m_pd.hDevNames = NULL;
if (dlg.DoModal() != IDOK)
return;
HDC hdc = dlg.GetPrinterDC();
ASSERT(hdc);
::GlobalFree(dlg.m_pd.hDevMode);
::GlobalFree(dlg.m_pd.hDevNames);
CDC *pPrintDC = CDC::FromHandle(hdc);
pPrintDC->StartDoc("Judgment Interest Calculation");
CFont font;
font.CreatePointFont(120, "Courier", pPrintDC)
// This code is from the MSDN help on
// CRichEditCtrl::FormatRange()
FORMATRANGE fr;
// Get the page width and height from the printer.
long lPageWidth = ::MulDiv(printDC->GetDeviceCaps
(PHYSICALWIDTH), 1440, printDC->GetDeviceCaps
(LOGPIXELSX));
long lPageHeight = ::MulDiv(printDC->GetDeviceCaps
(PHYSICALHEIGHT), 1440, printDC->GetDeviceCaps
(LOGPIXELSY));
CRect rcPage(0, 0, lPageWidth, lPageHeight);
pPrintDC->StartPage();
CFont *pOldFont = pPrintDC->SelectObject(&font);
// Format the text and render it to the printer->
fr.hdc = printDC->m_hDC;
fr.hdcTarget = printDC->m_hDC;
fr.rc = rcPage;
fr.rcPage = rcPage;
fr.chrg.cpMin = 0;
fr.chrg.cpMax = -1;
m_recDisplay.FormatRange(&fr, TRUE);
// Update the display with the new formatting.
RECT rcClient;
m_recDisplay.GetClientRect(&rcClient);
m_recDisplay.DisplayBand(&rcClient);
pPrintDC->SelectObject(pOldFont);
pPrintDC->EndPage();
pPrintDC->EndDoc();
pPrintDC->DeleteDC();
font.DeleteObject();
// END
The control ought to use the fonts you have set on the text, and so your
SelectObject outside the printing itself ought to be without effects.
Wouldn't it be easier to just set the font you want in the control itself?
Johan Rosengren
Abstrakt Mekanik AB
"Ryan Wagner" <rwa...@starcrest.ca> wrote in message
news:037301c2e0ef$24e6b460$3001...@phx.gbl...