Solved

Preview and Clipping Regions Coordinates

Posted on 1997-10-03
2
357 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
[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
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

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: 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…
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 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