[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
SelectObject( hDC, hGDIObject )-> <hPrevGDIObject>
------------------------------------------------------------------------------
PARAMETER:
<hDC> handle that identifies the target device context
<hGDIObject> is the handle of the GDI object to be selected. This can be
a pen, brush, font, bitmap, region, or a palette
RETURNS:
<hPrevGDIObject> is the handle of the object being replaced, if the
function is successful. Otherwise, it is zero.
DESCRIPTION:
SelectObject() selects an object into the given device context. The
new object replaces the previous object of the same type. You can use
SelectObject for instance to select another Font into a given Device
context, output a string with that font, and then select the previous font
again.
When an application uses this function to select a font, pen, or brush,
the system allocates space for that object in its data segment. Because
data-segment space is limited, an application should use the DeleteObject
function to remove each drawing object that it no longer required.
Before removing the object, the application should select it out of the
device context. To do this, the application can select a different object
of the same type back into the device context; typically, this different
object is the original object for the device context.
Memory device contexts are the only device contexts into which an
application can select a bitmap. A bitmap can be selected into only one
memory device context at a time.
The format of the bitmap must either be monochrome or be compatible with
the given device; if it is not, SelectObject returns an error.
EXAMPLE:
+-------------------------------------------------------------+
| /* Create a solid red brush and draw a rectangle */ |
| |
| hBrush := CreateSolidBrush( RGB( 255, 0, 0 )) |
| hBrOld := SelectObject( hDC, hBrush ) |
| |
| Rectangle( hDC, 10, 10, 100, 100 ) |
| |
+-------------------------------------------------------------+
Please lookup ExtTextOut for another example of SelectObject()
SOURCE:
SOURCE\WINAPI\SELOBJEC.C
See Also:
DeleteObject
ExtTextOut
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson