The ViewPort Explorer
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, and mouse capture and dragging, handling the CTRL key during a drag operation, and some cute graphical computation functions.
The views expressed in these essays are those of the author, and in no way represent, nor are they endorsed by, Microsoft.