Simple implementation of printing, and change print settings

zhaozj2021-02-16  51

Void PrintTest ()

{

CPRINTDIALOG DLG (false, pd_allpages | PD_COLLATE | PD_NOPAGENUMS | PD_HIDEPRINTTOFILE);

IF (Dlg.getDefaults ())

{

DEVMODE FAR * PDEVMODE = (DEVMODE FAR *) :: Globalock (DLG.M_PD.HDEVMODE);

PDEVMODE-> DMORIENTATION = DMORIENT_PORTRAIT; / / Change to portrait print

:: GlobalUnlock (dlg.m_pd.hdevmode);

Docinfo Di;

MEMSET (& DI, 0, SIZEOF (Docinfo);

Di.cbsize = sizeof (docinfo);

Di.lpszdocname = "Printing Test";

Di.lpszoutput = (lptstr) NULL;

Di.fWType = 0;

HDC HDC = DLG.CREATEPRINTERDC ();

CDC DC;

Dc.attach (HDC);

Dc.startDoc (& di);

Dc.startPage ();

Dc.moveto (0);

DC.LineTo (1000, 1000);

dc.endpage ();

Dc.Enddoc ();

dc.deletedc ();

}

}

转载请注明原文地址:https://www.9cbs.com/read-22837.html

New Post(0)