CBrush::CreateSysColorBrush
初始化画笔颜色。
BOOL CreateSysColorBrush(
int nIndex
);
参数
- nIndex
指定染料索引。 此值对应于用于的颜色绘制21的windows元素之一。 为值列表参见。Windows SDK 的 GetSysColor。
返回值
非零,如果成功;否则为0。
备注
画笔随后可以将选择作为当前画笔为所有设备上下文。
当应用程序完成使用 CreateSysColorBrush时创建的画笔,则应选择画笔在设备上下文之外。
示例
// Declare a CBrush and initialize to a system color.
CBrush brush;
brush.CreateSysColorBrush(COLOR_BTNFACE);
// Select the brush into the device context.
CBrush* pOldBrush = (CBrush*)pDC->SelectObject(&brush);
// Draw.
CRect rect(50, 50, 150, 150);
pDC->Rectangle(rect);
// Reselect the original brush.
pDC->SelectObject(pOldBrush);
要求
Header: afxwin.h