我想做打印功能,单想做基于对话框的。
我的实现方法是:
         CPrintDialog printDlg(FALSE);
//利用CPrintDialog 生成打印机设备环境
if (printDlg.DoModal() == IDCANCEL) return false;
// 连接到dc上
printdc.Attach(printDlg.CreatePrinterDC());
printdc.m_bPrinting = TRUE;
printdc.SetMapMode(MM_LOMETRIC); nHorRes = printdc.GetDeviceCaps(HORZRES);
nVerRes = printdc.GetDeviceCaps(VERTRES);
        nPixPerInchX=printdc.GetDeviceCaps(LOGPIXELSX);
nPixPerInchY=printdc.GetDeviceCaps(LOGPIXELSY);
// 设置打印作业
// 打印作业的定义信息
::ZeroMemory (&di, sizeof (DOCINFO));
di.cbSize = sizeof (DOCINFO);
di.lpszDocName = "评估结论表";
         printdc.StartDoc(&di);
         printdc.StartPage(); 
printdc.SetMapMode(MM_LOMETRIC);
         printdc.TextOut(nHorRes/2,0-VerRes/2,"This is a test");//输出
         printdc.EndPage(); 
printdc.EndDoc(); 
但是,打印出来总是不再中间,我想问问printdc.GetDeviceCaps(HORZRES);
printdc.GetDeviceCaps(VERTRES);得到的分别是什么?
printdc.TextOut(..)中的坐标和他的长度一致吗?
假设:printdc.GetDeviceCaps(HORZRES);printdc.GetDeviceCaps(VERTRES);分别是
4000,6000,那么我用printdc.TextOut(2000,-3000,"Test");输出的一定在中间吗?
确实很郁闷,请大家帮帮忙?????