?
Solved

Preview and Clipping Regions Coordinates

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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month7 days, 19 hours left to enroll

765 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