The GDI Mapping Mode

Up until now, all the sample programs have been drawing in units of pixels relative to the upper left corner of the client area. This is the default, but it’s not your only choice. One device context attribute that affects virtually all the drawing you do on the client area is the “mapping mode.” Four other device context attributes—the window origin, the viewport origin, the window extents, and the viewport extents—are closely related to the mapping mode attribute.

Most of the GDI drawing functions require coordinate values or sizes. For instance, this is the TextOut function:

TextOut (hdc, x, y, psText, iLength) ;

The x and y arguments indicate the starting position of the text. The x argument is the position on the horizontal ...

Get Programming Windows®, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.