CBrush::operator HBRUSH

使用此运算符获取 CBrush 对象的附加Windows GDI处理。

operator HBRUSH( ) const;

返回值

如果成功,句柄 CBrush 对象表示的Windows GDI对象;否则 NULL

备注

此运算符是强制转换运算符,支持对 HBRUSH 对象的直接使用。

有关使用图形对象的更多信息,请参见。Windows SDK的 图形对象

示例

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

Rectangle(pDC->GetSafeHdc(), rc.left, rc.top, rc.right, rc.bottom);

// The Win32 call to FillRect requires an HBRUSH.
// The HBRUSH operator casts the CBrush object
// to the required type.
CBrush brush;
brush.CreateSysColorBrush(COLOR_BTNFACE);
FillRect(pDC->GetSafeHdc(), &rc, (HBRUSH)brush);

要求

Header: afxwin.h

请参见

参考

CBrush选件类

层次结构图