Share via


SelectObject (Compact 2013)

3/28/2014

This function selects an object into a specified device context. The new object replaces the previous object of the same type.

Syntax

HGDIOBJ SelectObject(
  HDC hdc, 
  HGDIOBJ hgdiobj
); 

Parameters

  • hdc
    [in] Handle to the device context.

Return Value

If the selected object is not a region, the handle of the object being replaced indicates success.

If the selected object is a region, one of the following values indicates success.

Value

Description

SIMPLEREGION

Region consists of a single rectangle.

COMPLEXREGION

Region consists of more than one rectangle.

NULLREGION

Region is empty.

NULL indicates that an error occurred and the selected object is not a region. Otherwise, a GDI_ERROR value is returned.

Remarks

This function returns the previously selected object of the specified type.

An application should always replace a new object with the original, default object after it has finished drawing with the new object.

An application cannot select a bitmap into more than one device context at a time.

Requirements

Header

windows.h

Library

coredll.lib

See Also

Reference

GDI Functions
CombineRgn
CreateBitmap
CreateCompatibleBitmap
CreateDIBPatternBrushPt
CreateDIBSection
CreateFontIndirect
CreatePatternBrush
CreatePen
CreatePenIndirect
CreateRectRgn
CreateRectRgnIndirect
CreateSolidBrush
SelectClipRgn