MFC and Landscape Printing
Gerry Sweeney -- gerry@hornbill.com Wednesday, December 04, 1996 Environment: VC++ 4.2-flat, Win 95, WinNT 4.0 Dear Listers, I have an application that prints (good he!) and I would like to print in landscape by default. I am sure I have seen the answer to this on the list at some point but it is not in my archives. Can anyone help? Regards Gerry Sweeney gerry@hornbill.com
Vincent W. Mayfield -- vmax@gulf.net Saturday, December 07, 1996 [Mini-digest: 3 responses] Gerry, Check out the following Knowledge base article in the Visual C++ books on line : How to Change Default Printer Settings in an MFC Application PSS ID Number: Q126897 Article last modified on 01-21-1996 Vinny Vincent W. Mayfield Senior Software Engineer vmax@gulf.net "It is better to beg for forgiveness than ask for permission." ---------- From: Gerry Sweeney[SMTP:gerry@hornbill.com] Sent: Wednesday, December 04, 1996 4:40 AM To: mfc-l Subject: MFC and Landscape Printing Environment: VC++ 4.2-flat, Win 95, WinNT 4.0 Dear Listers, I have an application that prints (good he!) and I would like to print in landscape by default. I am sure I have seen the answer to this on the list at some point but it is not in my archives. Can anyone help? Regards Gerry Sweeney gerry@hornbill.com -----From: "Sanu M Palil"Change the paper orientation inside your View class OnPrepareDC as shown below. void CMyView::OnPrepareDC(CDC* pDC,CPrintInfo* pInfo) { LPDEVMODE pDevMode; if (pDC->IsPrinting()) { pDevMode = pInfo->m_pPD->GetDevMode(); pDevMode->dmOrientation = DMORIENT_LANDSCAPE; pDC->ResetDC(pDevMode); } } - Sanu. ---------- > From: Gerry Sweeney > To: mfc-l > Subject: MFC and Landscape Printing > Date: Wednesday, December 04, 1996 2:40 AM > > > Environment: VC++ 4.2-flat, Win 95, WinNT 4.0 > > > Dear Listers, > > I have an application that prints (good he!) and I would like to print in > landscape by default. I am sure I have seen the answer to this on the list > at some point but it is not in my archives. > > Can anyone help? > > > Regards > > Gerry Sweeney > gerry@hornbill.com -----From: CADD Design Solutions At 10:40 AM 12/4/96 G, you wrote: > >Environment: VC++ 4.2-flat, Win 95, WinNT 4.0 > > >Dear Listers, > >I have an application that prints (good he!) and I would like to print in >landscape by default. I am sure I have seen the answer to this on the list >at some point but it is not in my archives. > >Can anyone help? > > >Regards > >Gerry Sweeney >gerry@hornbill.com > > Here's a code snippet that works with MSVC++ v1.52 - you may be able to make it work in your situation. /***************************************************************************/ /* */ /* SetLandscape: force printer into landscape mode */ /* */ /***************************************************************************/ void YourApp::SetLandscape () { PRINTDLG pd; pd.lStructSize = (DWORD) sizeof (PRINTDLG); // force CWinApp to initialize printer and setup defaults if (GetPrinterDeviceDefaults (&pd)) { // now lock down the defaults DEVMODE FAR *pDevMode = (DEVMODE FAR*)::GlobalLock (m_hDevMode); if (pDevMode) { // Change printer settings in here. pDevMode->dmOrientation = DMORIENT_LANDSCAPE; ::GlobalUnlock (m_hDevMode); } } } ----------------------------------------------- Shawn L. Bradley CADD Design Solutions e-mail: cds@59mail.idt.net Visit our web site for latest news, neat tips, and FREE AutoLISP utilities! http://metropolis.idt.net/~cds59 ----------------------------------------------- All that must happen for evil to prevail, is for good men to do nothing. -Edmund Burke "A democracy cannot exist as a permanent form of government. It can only exist until the voters discover that they can vote themselves money from the Public Treasury. From that moment on, the majority always votes for the candidates promising the most benifits from the Public Treasury with a result that a democracy always collapses over loose fiscal policy always followed by a dictatorship." -Alexander Fraser Tytler
| Вернуться в корень Архива |