阅读:1547回复:1
vb+mapx打印的问题?高手指教
<P>我用的这个函数代码是从例子里帖到我的程序里的,只不过我用的是单文档窗口,例子是多文档窗口。例子打印没有问题。我打印就报地址错误。为什么?请高手指点!</P>
<P>以下是我的打印函数:</P> <P>void CAppClientView::OnPrint(CDC* pDC, CPrintInfo* pInfo) <BR>{<BR> try {<BR> double dPaperWidth;<BR> double dPaperHeight;<BR> CPoint ptVpOrg;<BR> CSize szVExt;</P> <P> // get paper width in cm and convert to HIMETRIC (100th of a mm)<BR> m_ctrlMapX.SetPaperUnit(miUnitCentimeter);<BR> dPaperWidth = m_ctrlMapX.GetMapPaperWidth() * 10 * 100;<BR> dPaperHeight = m_ctrlMapX.GetMapPaperHeight()* 10 * 100;</P> <P> ::GetViewportOrgEx(pDC->m_hDC, ;ptVpOrg);<BR> ptVpOrg.x = (long)((double)ptVpOrg.x/96.0 * 2540.0);<BR> ptVpOrg.y = (long)((double)ptVpOrg.y/96.0 * 2540.0);</P> <P> if (pInfo->m_bPreview) {<BR> // now get our drawing width in himetric<BR> // during print preview the ViewportExtent has this<BR> ::GetViewportExtEx(pDC->m_hDC, ;szVExt);<BR> pDC->DPtoHIMETRIC(;szVExt);<BR> // also, keep the aspect ration of the map so it isn't distorted<BR> szVExt.cy = (long)((double)szVExt.cy * (dPaperHeight/dPaperWidth));<BR> m_ctrlMapX.PrintMap((long)pDC->m_hDC, ptVpOrg.x, ptVpOrg.y, szVExt.cx, szVExt.cy);<BR> }<BR> else {<BR> m_ctrlMapX.PrintMap((long)pDC->m_hDC, ptVpOrg.x, ptVpOrg.y, (long)dPaperWidth, (long)dPaperHeight);<BR> }<BR> }<BR> catch (COleDispatchException *e) {<BR> e->ReportError();<BR> e->Delete();<BR> }<BR> catch (COleException *e) {<BR> e->ReportError();<BR> e->Delete();<BR> }<BR> CView::OnPrint(pDC, pInfo);<BR>}</P> |
|
1楼#
发布于:2006-07-10 15:40
对不起,是vc+mapx,
|
|