?
Solved

Preview and Clipping Regions Coordinates

Posted on 1997-10-03
2
Medium Priority
?
367 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 150 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

862 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