Solved

Preview and Clipping Regions Coordinates

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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 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.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 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

16 Experts available now in Live!

Get 1:1 Help Now