此帖出自嵌入式系统论坛
最新回复
void CMyDialog::Print()
{
CDC dc;
CPrintDialog printDlg(FALSE);
if (printDlg.DoModal() == IDCANCEL) // Get printer settings from user
return;
dc.Attach(printDlg.GetPrinterDC()); // Get and attach a printer DC
dc.m_bPrinting = TRUE;
CString strTitle; // Get the application title
strTitle.LoadString(AFX_IDS_APP_TITLE);
DOCINFO di; // Initialise print document details
::ZeroMemory (&di, sizeof (DOCINFO));
di.cbSize = sizeof (DOCINFO);
di.lpszDocName = strTitle;
BOOL bPrintingOK = dc.StartDoc(&di); // Begin a new print job
// Get the printing extents and store in the m_rectDraw field of a
// CPrintInfo object
CPrintInfo Info;
Info.m_rectDraw.SetRect(0,0,
dc.GetDeviceCaps(HORZRES),
dc.GetDeviceCaps(VERTRES));
OnBeginPrinting(&dc, &Info); // Call your "Init printing" function
for (UINT page = Info.GetMinPage();
page 0); // end page
}
OnEndPrinting(&dc, &Info); // Call your "Clean up" function
if (bPrintingOK)
dc.EndDoc(); // end a print job
else
dc.AbortDoc(); // abort job.
dc.DeleteDC(); // delete the printer DC
}
复制代码
详情
回复
发表于 2009-5-19 14:59
| ||
|
||
| |
|
|
| |
|
|
此帖出自嵌入式系统论坛
| ||
|
||
此帖出自嵌入式系统论坛
| ||
|
||
提示: 作者被禁止或删除 内容自动屏蔽
| |
|
|
| |
|
|
| |
|
|
此帖出自嵌入式系统论坛
| ||
|
||
EEWorld Datasheet 技术支持