Hey,
I am printing information from combo boxes and edit boxes out on paper, and at the moment I am using DrawText(). But I don't know how to get it to draw it in a different place. I looked at TextOut() and it had int x and int y, so like coordinates. Would that be better for waht I am doing or does someone know how to move the draw text around?
Here is my code so you can see how it is being done.
Code:
void CDEPDlg::OnPrintEditControl() {
//// Create a printer DC
CPrintDialog dlg(FALSE);
CDC dc;
#if 0 //Show print dialog.
if (dlg.DoModal() == IDCANCEL)
return;
dc.Attach(dlg.GetPrinterDC());
#else //Don't show print dialog.
PRINTDLG prtDlg;
AfxGetApp()->GetPrinterDeviceDefaults(&prtDlg); //Should check for error.
dlg.m_pd.hDevMode = prtDlg.hDevMode;
dlg.m_pd.hDevNames = prtDlg.hDevNames;
dc.Attach(dlg.CreatePrinterDC());
#endif
dc.m_bPrinting = TRUE;
//// Now use the DC.
//Get the page size.
CRect printArea;
printArea.SetRect(0, 0, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
//Start printing.
DOCINFO docinfo;
memset(&docinfo, 0, sizeof(docinfo));
docinfo.cbSize = sizeof(docinfo);
docinfo.lpszDocName = _T("Edit Control Print");
dc.StartDoc(&docinfo); //Should check for error.
dc.StartPage(); //Should check for error.
//Draw the edit control contents.
CString sText;
m_type1.GetWindowText(sText);
dc.DrawText(sText, printArea, DT_NOPREFIX | DT_WORDBREAK);
//End printing
dc.EndPage();
dc.EndDoc();
}
Thanks for the help