Solved

set orientation when priting

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand LInux Boot partition remotly 3 96
Get filename and folder into excel 7 79
pre4 challenge 19 104
Dell Alienware Graphics Amplifier Driver for non-Alienware systems 18 347
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.

860 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