Share via


CBrush::operator HBRUSH

operator HBRUSH( ) const;

Return Value

If successful, a handle to the Windows GDI object represented by the CBrush object; otherwise NULL.

Remarks

Use this operator to get the attached Windows GDI handle of the CBrush object. This operator is a casting operator, which supports direct use of an HBRUSH object.

For more information about using graphic objects, see in the Win32 SDK Programmer’s Reference.

Example

RECT rc = { 50, 50, 200, 200 };

Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);

// The Win32 call to FillRect requires an HBRUSH.
// The HBRUSH operator used here makes a temporary
// CBrush object which is cast to the required type.
FillRect(hDC, &rc, (HBRUSH)(COLOR_BTNFACE+1));

CBrush OverviewClass MembersHierarchy Chart