Solved

set orientation when priting

Posted on 1998-07-15
3
305 Views
Last Modified: 2013-11-20
Hi!
I am using VC++ 5.0 with MFC.
I'd like to know how and when I have to manipulate the DEVMODE struct of my CPrintDialog in order to set the print orientation to either landscape or portrait.
Thanks a bundle,

Daniel
0
Comment
Question by:tsunami070898
3 Comments
 
LVL 2

Accepted Solution

by:
AlFa earned 20 total points
ID: 1319214
this is an example of one of my pgm

      LPDEVMODE  pDvMd = pInfo->m_pPD->GetDevMode();
//Get the devmode struct
      if(pInfo->m_nCurPage >3)//choose when it is usefull to change
      {
            pDvMd->dmOrientation = DMORIENT_PORTRAIT;
      }
      else
      {
            pDvMd->dmOrientation = DMORIENT_PORTRAIT;
      }
      pDC->ResetDC(pDvMd);
//      GlobalFree(pDvMd); // do not destroy the struct is is a documentation error

0
 
LVL 4

Expert Comment

by:chabaud
ID: 1319215
The When is : override the OnPrepareDC function of your derived Cview class.

void CMyView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo)
{
.
}

0
 

Author Comment

by:tsunami070898
ID: 1319216
Thanks for your help, both of you.
At first, it did not work, because I did not have a page setup dialog object constructed. But after that modification, it work as advertised.




0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question