CBrush *pBrush = CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH));
CBrush *pOldBrush = pDC->SelectObject(pBrush);
pDC->SelectObject(pOldBrush);
//创建蓝色画刷,代码如下:
void CDrawView::OnDraw(CDC* pDC)
{
CDrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CBrush brush;
brush.CreateSolidBrush(RGB(0, 0, 255));
CBrush *pOldBrush = pDC->SelectObject(&brush);
pDC->Rectangle(100, 100, 400, 200);
pDC->SelectObject(pOldBrush);
}