Click here to Skip to main content
11,796,774 members (81,234 online)
Click here to Skip to main content

The ViewPort Explorer

, 11 Jul 2005 41.8K 1.3K 56
Rate this:
Please Sign up or sign in to vote.
A viewport explorer utility.


This little project came about because I found what I thought was an error in a description of mapping modes. The author insisted the description was correct, so to prove that it was wrong, I wrote a little program that demonstrated what was going on. The result demonstrated that I was correct.

However, the program seemed quite useful, so I enhanced it. It has all sorts of interesting features that might be useful beyond its ability to demonstrate SetWindowOrg, SetWindowExt, SetViewportOrg and SetViewportExt.

The application dialog is shown below. It allows setting the parameters for the four scaling APIs, and options for selecting the mapping mode.

Because changing modes can make the axis indicators move off-screen, the "circles" option provides a "finder" capability (like that found on oscilloscopes) so you can drag the image around.

This demonstrates the use of mapping modes and the use of logical coordinates. It also implements DPtoLP and LPtoDP. In the picture, note that MM_ANISOTROPIC was selected, and both the values for the window extent are negative, thus reversing the normal axis, with x increasing to the left and y increasing upwards.

Other cute features include the owner-draw buttons with arrows, mouse capture and dragging, handling the CTRL key during a drag operation, and some cute graphical computation functions.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Joseph M. Newcomer
United States United States
PhD, Computer Science, Carnegie Mellon University, 1975
Certificate in Forensic Science and the Law, Duquesne University, 2008

Co-Author, [i]Win32 Programming[/i]

You may also be interested in...

Comments and Discussions

QuestionI am very happy to see the source, but i have found four missing code? Pin
Member 33719029-Jul-09 21:27
memberMember 33719029-Jul-09 21:27 
GeneralVery helpful Pin
caram8823-Dec-08 13:25
membercaram8823-Dec-08 13:25 
GeneralText considerations Pin
prcarp11-Jul-05 3:09
memberprcarp11-Jul-05 3:09 
This is a nice tool for newbies learning how all the mapping features work in windows. I think I may use it to show to some of my students who are geometrically challenged... Smile | :)

One thought: You may want to add one more feature with respect to TextOut and DrawText. In some modes, the text is mirrored and is a pain in the __ to counteract. Perhaps just add another group box to display text and perhaps show the box or point where the text was drawn.

GeneralRe: Text considerations Pin
Joseph M. Newcomer11-Jul-05 14:47
memberJoseph M. Newcomer11-Jul-05 14:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151002.1 | Last Updated 11 Jul 2005
Article Copyright 2005 by Joseph M. Newcomer
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid