Solved

Setting Printer Margins

Posted on 1997-04-23
1
259 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
1 Comment
 
LVL 1

Accepted Solution

by:
jmmougeolle earned 100 total points
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

772 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

9 Experts available now in Live!

Get 1:1 Help Now