我想横行打印,但是 preview 时纸张总是 竖的,还得手工设置,怎样才能编程设定呢?
void SetPrntOrientation()
{
/*
dmOrientation
For printer devices only,
selects the orientation of the paper.
This member can be either
DMORIENT_PORTRAIT (1) or
DMORIENT_LANDSCAPE (2).
纵向: portrait
横向: landscape orientation
*/ PRINTDLG pd;
pd.lStructSize=(DWORD)sizeof(PRINTDLG);
BOOL bRet=GetPrinterDeviceDefaults(&pd);
if(bRet)
{
// protect memory handle with ::GlobalLock and ::GlobalUnlock
DEVMODE FAR *pDevMode=(DEVMODE FAR *)::GlobalLock(m_hDevMode);
// set orientation to landscape
pDevMode->dmOrientation=DMORIENT_PORTRAIT;//DMORIENT_LANDSCAPE;
::GlobalUnlock(m_hDevMode);
}
}