?
Solved

Setting Printer Margins

Posted on 1997-04-23
1
Medium Priority
?
287 Views
Last Modified: 2013-11-20
When I print a document, MFC changes the origion of the device context to the printable area of a page.  The problem is I can't figure out what this origion is.  Point (0, 0) doesn't refer to the top, left corner of the page.  I've tried using all the CDC Mapping Functions, GetWindowOrg(), GetViewportOrg(), etc, to determine what the origion is set at but they don't appear to return the correct value.
0
Comment
Question by:blaster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
jmmougeolle earned 300 total points
ID: 1301175
In the CView::OnBeginPrinting(CDC *pDC, CPrintInfo * pInfo)

you could retrieve the margin values from the CDC::Escape method, calling it in that way:

      CPoint      ptPageStart;
      pDC->Escape( GETPRINTINGOFFSET,
                                        0, NULL,
                                        (LPSTR) &ptPageStart);

GetWindowOrg, and GetViewportOrg, don't take in account this margine, and are only referring to the drawable Area.

In that way, the 0,0 origin corresponds to the marginX, marginY point from the Left Top Paper Corner (If you don't change the MapMode)

0

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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…
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.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses
Course of the Month12 days, 11 hours left to enroll

777 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