Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

set orientation when priting

Posted on 1998-07-15
3
Medium Priority
?
320 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 60 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
Loops Section Overview
Suggested Courses

886 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