CGdiObject Class

Provides a base class for various kinds of Windows graphics device interface (GDI) objects such as bitmaps, regions, brushes, pens, palettes, and fonts.

class CGdiObject : public CObject

Members

Public Constructors

Name

Description

CGdiObject::CGdiObject

Constructs a CGdiObject object.

Public Methods

Name

Description

CGdiObject::Attach

Attaches a Windows GDI object to a CGdiObject object.

CGdiObject::CreateStockObject

Retrieves a handle to one of the Windows predefined stock pens, brushes, or fonts.

CGdiObject::DeleteObject

Deletes the Windows GDI object attached to the CGdiObject object from memory by freeing all system storage associated with the object.

CGdiObject::DeleteTempMap

Deletes any temporary CGdiObject objects created by FromHandle.

CGdiObject::Detach

Detaches a Windows GDI object from a CGdiObject object and returns a handle to the Windows GDI object.

CGdiObject::FromHandle

Returns a pointer to a CGdiObject object given a handle to a Windows GDI object.

CGdiObject::GetObject

Fills a buffer with data that describes the Windows GDI object attached to the CGdiObject object.

CGdiObject::GetObjectType

Retrieves the type of the GDI object.

CGdiObject::GetSafeHandle

Returns m_hObject unless this is NULL, in which case NULL is returned.

CGdiObject::UnrealizeObject

Resets the origin of a brush or resets a logical palette.

Public Operators

Name

Description

CGdiObject::operator !=

Determines if two GDI objects are logically not equal.

CGdiObject::operator ==

Determines if two GDI objects are logically equal.

CGdiObject::operator HGDIOBJ

Retrieves a HANDLE to the attached Windows GDI object.

Public Data Members

Name

Description

CGdiObject::m_hObject

A HANDLE containing the HBITMAP, HPALETTE, HRGN, HBRUSH, HPEN, or HFONT attached to this object.

Remarks

You never create a CGdiObject directly. Rather, you create an object from one of its derived classes, such as CPen or CBrush.

For more information on CGdiObject, see Graphic Objects.

Inheritance Hierarchy

CObject

CGdiObject

Requirements

Header: afxwin.h

See Also

Reference

Hierarchy Chart

CBitmap Class

CBrush Class

CFont Class

CPalette Class

CPen Class

CRgn Class