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 |
|
cf54a330-63ef-421f-83eb-90ec7bd82eef |
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]
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.