我想做打印功能,单想做基于对话框的。
我的实现方法是:
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");输出的一定在中间吗?
确实很郁闷,请大家帮帮忙?????
我的实现方法是:
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");输出的一定在中间吗?
确实很郁闷,请大家帮帮忙?????
解决方案 »
- 在activex中引发事件,是否不能将引发事件函数写在全局函数中?
- 在子函数里面如何获取实例
- 求助VC高手!!!
- 如何判断ListView和TreeView中的Item是否被高亮选中??
- 简单问题请教:用对话框资源创建类的时候,如何选择从别处拷贝来的对话框类(而不是默认基类CDialog)?谢谢!
- 发现一个新论坛,很不错,大家有空去看看,那正招斑竹
- 学习《Windows程序设计》中遇到了困难,怎么调试??
- vs6中的depends.exe在vs.net里怎么不见了?
- 怎样编程把一台win98的机器变成TFTP或是FTP服务器?
- MFC "启动但不侦错"时没有回应,但侦错时正常
- 有谁知道深圳新天下集团这个公司哦
- 想导出一个类,该怎么做?
printdc. DPtoLP(&Rect);
printdc.GetDeviceCaps(VERTRES);
得到的是纸张的信息吧?