Selecting Objects into a Device Context

A device context always contains one pen to draw lines, one brush to fill areas, one font to output characters, and a series of other values to control how the device context behaves. If the application requires a different font, the font is selected into the device context prior to displaying the text. Selecting a new font does not change existing text on the window's client area.

When using a shared device context, have the application restore the settings of the device context before calling ReleaseDC. Objects created and selected into the DC, such as pens and brushes, should be deleted after calling ReleaseDC. Do not attempt to delete objects retrieved with the GetStockObject function. See Chapter 15, ...

Get Microsoft Windows 2000 API SuperBible 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.