HGDIOBJ SelectObject(hdc, hgdiobj) | |||||
HDC hdc; | /* handle of device context | */ | |||
HGDIOBJ hgdiobj; | /* handle of object | */ |
The SelectObject function selects an object into the given device context. The new object replaces the previous object of the same type.
hdc
Identifies the device context.
hgdiobj
Identifies the object to be selected. The object can be one of the following and must have been created by using one of the listed functions:
Object | Functions |
Bitmap | ||
CreateBitmap, CreateBitmapIndirect, CreateCompatibleBitmap, CreateDIBitmap | ||
(Bitmaps can be selected for memory device contexts only, and for only one device context at a time.) | ||
Brush | ||
CreateBrushIndirect, CreateHatchBrush, CreatePatternBrush, CreateSolidBrush CreateDIBPatternBrush | ||
Font | ||
CreateFont, CreateFontIndirect | ||
Pen | ||
CreatePen, CreatePenIndirect | ||
Region | ||
CombineRgn, CreateEllipticRgn, CreateEllipticRgnIndirect, CreatePolygonRgn, CreateRectRgn, CreateRectRgnIndirect |
The return value is the handle of the object being replaced, if the function is successful. Otherwise, it is NULL.
If the hgdiobj parameter identifies a region, this function performs the same task as the SelectClipRgn function and the return value is SIMPLEREGION (region has no overlapping borders), COMPLEXREGION (region has overlapping borders), or NULLREGION (region is empty). If an error occurs, the return value is ERROR and the previously selected object of the specified type remains selected in the device context.
This function returns the previously selected object of the given type. The application should remember the default selected objects and select them back into the DC when finished.
An application cannot select a bitmap into more than one device context at a time.
SelectClipRgn, SelectPalette