Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 1.7 KB

selecting-a-graphic-object-into-a-device-context.md

File metadata and controls

30 lines (19 loc) · 1.7 KB
description title ms.date helpviewer_keywords ms.assetid
Learn more about: Selecting a Graphic Object into a Device Context
Selecting a Graphic Object into a Device Context
11/04/2016
graphic objects [MFC], selecting into device context
SelectObject method [MFC]
GDI objects [MFC], device contexts
lifetime, graphic objects [MFC]
device contexts, selecting graphic objects into
device contexts, graphic objects [MFC]
cf54a330-63ef-421f-83eb-90ec7bd82eef

Selecting a Graphic Object into a Device Context

This topic applies to using graphic objects in a window's device context. After you create a drawing object, you must select it into the device context in place of the default object stored there:

[!code-cppNVC_MFCDocViewSDI#7]

Lifetime of Graphic Objects

The graphic object returned by SelectObject is "temporary." That is, it will be deleted by the OnIdle member function of class CWinApp the next time the program gets idle time. As long as you use the object returned by SelectObject in a single function without returning control to the main message loop, you will have no problem.

What do you want to know more about

See also

Graphic Objects