Enlarge font size and printing margin, when printing from multi-line
CEdit
Finally, I manage to get code snippet to make multipline CEdit
printing works. It works pretty well with unicode and tab.
void HelloWorld::PrintReport()
{
CPrintDialog pDiag(FALSE, PD_RETURNIC |
PD_RETURNDC | PD_DISABLEPRINTTOFILE |
PD_NOPAGENUMS | PD_NOSELECTION, NULL);
if (pDiag.DoModal() == IDOK)
{
HDC hPDC = pDiag.GetPrinterDC();
CDC DC;
DC.Attach(hPDC);
// This is the way I try to enlarge the printing font size.
// However, it seems doesn't work well.
// The effect is just same as without explicit DC's
SelectObject
//
// Currently, The screen display font size at CEdit is OK.
// However, the output to the paper is just *too* small.
CFont font;
LOGFONT logFont;
this->text_area.GetFont().GetLogFont(&logFont);
logFont.lfHeight = 1000;
font.CreateFontIndirectW(&logFont);
DC.SelectObject(&font);
TCHAR DocName[32] = _T("Error Log");
DOCINFO DI;
ZeroMemory(&DI, sizeof(DOCINFO));
DI.cbSize = sizeof(DI);
DI.lpszDocName = DocName;
if (DC.StartDoc(&DI) != -1)
{
DC.StartPage();
DC.SetMapMode(MM_TEXT);
// text_area is my multiline CEdit.
this->text_area.Print(&DC, PRF_CLIENT);
DC.EndPage();
DC.EndDoc();
}
else
{
AfxMessageBox(_T("Couldn't Print"));
}
font.DeleteObject();
}
}
1. How I can enlarge my font size, with rest of the font attribute
remains the same?
2. The output is with 0 margin. I would like to have same space
from the left. How I can do so?
Thanks.