首页上一页 1 下一页尾页 1 条记录 1/1页
范例宝典292
发表在C语言图书答疑
2009-12-23
是否精华
是
否
版块置顶:
是
否
void CEasyReportDlg::OnPrint()
{
// TODO: Add your control notification handler code here
CPreview dlg;
CPrintDialog m_printdlg(false);
if (m_printdlg.DoModal()==IDOK)
{
CDC dc1;
dc1.Attach(m_printdlg.GetPrinterDC());
int leftmargin;
leftmargin = dc1.GetDeviceCaps(PHYSICALOFFSETX);
CRect m_rect(-leftmargin,0,dc1.GetDeviceCaps(PHYSICALWIDTH)-leftmargin,dc1.GetDeviceCaps(PHYSICALHEIGHT)) ;
dlg.DrawReport(m_rect,&dc1,true);
}
}
感觉CRect m_rect(-leftmargin,0,dc1.GetDeviceCaps(PHYSICALWIDTH)-leftmargin,dc1.GetDeviceCaps(PHYSICALHEIGHT)) ;应该为CRect m_rect(leftmargin,0,dc1.GetDeviceCaps(PHYSICALWIDTH)-leftmargin,dc1.GetDeviceCaps(PHYSICALHEIGHT)) ;
就是把-leftmargin改为leftmargin,因为是把打印页的原点作为起点的,为去掉物理页面左间距就左移leftmargin设备距离。
可能我理解错了,请指正!
{
// TODO: Add your control notification handler code here
CPreview dlg;
CPrintDialog m_printdlg(false);
if (m_printdlg.DoModal()==IDOK)
{
CDC dc1;
dc1.Attach(m_printdlg.GetPrinterDC());
int leftmargin;
leftmargin = dc1.GetDeviceCaps(PHYSICALOFFSETX);
CRect m_rect(-leftmargin,0,dc1.GetDeviceCaps(PHYSICALWIDTH)-leftmargin,dc1.GetDeviceCaps(PHYSICALHEIGHT)) ;
dlg.DrawReport(m_rect,&dc1,true);
}
}
感觉CRect m_rect(-leftmargin,0,dc1.GetDeviceCaps(PHYSICALWIDTH)-leftmargin,dc1.GetDeviceCaps(PHYSICALHEIGHT)) ;应该为CRect m_rect(leftmargin,0,dc1.GetDeviceCaps(PHYSICALWIDTH)-leftmargin,dc1.GetDeviceCaps(PHYSICALHEIGHT)) ;
就是把-leftmargin改为leftmargin,因为是把打印页的原点作为起点的,为去掉物理页面左间距就左移leftmargin设备距离。
可能我理解错了,请指正!