Solved

Setting Printer Margins

Posted on 1997-04-23
1
273 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 100 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeateFront java challenge 31 95
Unix / Linux grid computing 5 169
unable to delete all specified values regedit 38 729
fizzArray2 challenge 1 103
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.

726 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