1.调用方法_打印预览
CPrintFrame* pWndPrint = new CPrintFrame;
CCreateContext context;
context.m_pNewViewClass = RUNTIME_CLASS(CPrintView);
context.m_pCurrentFrame = pWndPrint;
context.m_pCurrentDoc = NULL;
context.m_pLastView = NULL;
pWndPrint->Create(NULL,"打印",WS_OVERLAPPEDWINDOW,CFrameWnd::rectDefault,
NULL,NULL,0,&context);
pWndPrint->PrintPreview();
2.调用方法_直接打印
CPrintFrame* pWndPrint = new CPrintFrame;
CCreateContext context;
context.m_pNewViewClass = RUNTIME_CLASS(CPrintView);
context.m_pCurrentFrame = pWndPrint;
context.m_pCurrentDoc = NULL;
context.m_pLastView = NULL;
pWndPrint->Create(NULL,"打印",WS_OVERLAPPEDWINDOW,CFrameWnd::rectDefault,
NULL,NULL,0,&context);
pWndPrint->Print();
3.参数设置
可设置打印方向,映射模式、打印页数等,测试样例使用的是DMORIENT_LANDSCAPE(横向打印),MM_LOMETRIC,10页
好用的话,大家给个好评哦
1