Solved

Preview and Clipping Regions Coordinates

Posted on 1997-10-03
2
353 Views
Last Modified: 2013-11-19
I'm using regions for clipping graphics in printouts like:
      CRgn rgn;  ...  pDC->SelectClipRgn(&rgn);
This works fine only for the real print, not for the screen-preview. It seems that SelectClipRgn needs the real screen-coordinates instead of the printer-coordinates for correct clipping in preview-mode ?!
How can I transform the preview printer coordinates in real screen-coordinates? This should also be usefull for calculating the paper position for mouse clicks on the preview screen..   Thorsten
BTW: ScreenToClient and ClientToScreen doesn't solve the problem?!
0
Comment
Question by:todi
2 Comments
 
LVL 3

Accepted Solution

by:
byang earned 50 total points
ID: 1307438
If your coordinates is in real-world unit, like mm or inch, then just set the apppropriate mapping mode at preview time.

If your coordinates are in printer device unit, then you need to write code to convert coordinates at preview time.

Or you can setup a mapping mode using SetMapMode(,MM_ANISOTROPIC), SetWindowExtEx, and SetViewportExtEx.
0
 

Author Comment

by:todi
ID: 1307439
Thanks for your answer!
Before I read your answer, I tried coordinates in printer device units, and I didn't convert them to screen coordinates. So my clipping region only works on the printer, not at preview time.

-> How can I convert them at preview time? <-

I changed the mapping mode to "mm_lometric" but the clipping was only correct on the printer. I think I've done it right?!
Is there really an internal routine converting the printer coordinates for the preview in screen-coordinates, or does "pDC->SetClipRgn" needs screen coordinates everytime, not depending on the mapping mode?

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

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…
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 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.

863 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

24 Experts available now in Live!

Get 1:1 Help Now