Solved

set orientation when priting

Posted on 1998-07-15
3
297 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
Comment Utility
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
Comment Utility
The When is : override the OnPrepareDC function of your derived Cview class.

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

0
 

Author Comment

by:tsunami070898
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Replacement selected text 2 47
Process filename extension 3 155
withoutTen challenge 14 88
Path of Workbook 3 44
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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now