高难度 如何在打印预览中改变纸张的大小方向等? 就是在打印预览中加一个按钮,按下一次后纸张就变成横向,再按一下,纸张就变成竖向 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 另外,要在PRINT PRVEIEW中改变页边距的大小,象EXCEL一样 得修改MFC类库的打印预览代码!我单位的就是这么解决的! 在OnPrepareDC中对目标页调用pDC->Offsetviewport();即可改变页边距 void EkChangePrintingOrientation( CDC* pDC, CPrintInfo* pInfo, short NewOrientation ){ ASSERT_VALID( pDC ); ASSERT( pInfo != NULL ); DEVMODE* pDevMode = pInfo->m_pPD->GetDevMode(); // Only change if new orientation is different if( pDevMode->dmOrientation != NewOrientation ) { pDevMode->dmOrientation = NewOrientation; pDC->ResetDC( pDevMode ); }}void CDrawView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) { // Programatically force the page's orientation if( pInfo != NULL ) { // Find out the orientation we want: every third page // will print in "landscape" mode BOOL bLandscape = ( ( pInfo->m_nCurPage % 3 ) == 0 ); short NewOrientation = bLandscape ? DMORIENT_LANDSCAPE : DMORIENT_PORTRAIT; EkChangePrintingOrientation( pDC, pInfo, NewOrientation ); } CView::OnPrepareDC(pDC, pInfo); pDC->SetMapMode( MM_LOMETRIC );}这是“MFC经典问答”上的例子 参考:http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=186073 如何使用双缓冲在Button上画png? 请教:如何提高程序运行速度? 列表框中如何获得当前选择栏的数据? ::是什么操作符?什么意思? 请教:谁有汉字编码范围表?谢谢! ▁▂▃▄▅ 51% ▅▄▃▂▁ 怎样为服务程序加上描述?谢谢!!! 如何将窗口居中显示 请问在VC 中如何读写文件速度最快? 怎样才能更好的了解MFC类库? 还是键盘的消息响应的问题,我实在解决不了了,那为大侠能帮帮我,求求你了! 请问如何设置计算机的IP地址 大家帮忙啊,小弟实在晕了,100分~小弟穷,所有就这些分了
{
ASSERT_VALID( pDC );
ASSERT( pInfo != NULL ); DEVMODE* pDevMode = pInfo->m_pPD->GetDevMode(); // Only change if new orientation is different
if( pDevMode->dmOrientation != NewOrientation )
{
pDevMode->dmOrientation = NewOrientation;
pDC->ResetDC( pDevMode );
}
}void CDrawView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo)
{
// Programatically force the page's orientation
if( pInfo != NULL )
{
// Find out the orientation we want: every third page
// will print in "landscape" mode
BOOL bLandscape = ( ( pInfo->m_nCurPage % 3 ) == 0 );
short NewOrientation = bLandscape ? DMORIENT_LANDSCAPE : DMORIENT_PORTRAIT; EkChangePrintingOrientation( pDC, pInfo, NewOrientation );
} CView::OnPrepareDC(pDC, pInfo); pDC->SetMapMode( MM_LOMETRIC );
}
这是“MFC经典问答”上的例子