Solved

set orientation when priting

Posted on 1998-07-15
3
300 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

832 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