Solved

Setting Printer Margins

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Named range not carried over 10 62
dog bark java program 15 87
either24  challenge 19 90
Bartender label printing - switch on and off graphics 3 10
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

910 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

22 Experts available now in Live!

Get 1:1 Help Now