创建画笔:
CPen pen(PS_SOLID,1,RGB(255,0,0));
CPen *pOldPen=dc.SelectObject(&pen);
dc.SelectObject(pOldPen);
创建普通画刷
CClientDC dc(this);
CBrush brush(RGB(255,0,0));
dc.FillRect(CRect(m_ptOrigin,point),&brush);
创建透明画刷
CClientDC dc(this);
CBrush *pBrush=CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH));
CBrush *pOldBrush=dc.SelectObject(pBrush);
dc.Rectangle(CRect(m_ptOrigin,point));
dc.SelectObject(pOldBrush);
创建位图画刷
CClientDC dc(this);
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BITMAP1);
CBrush brush(&bitmap);
dc.FillRect(CRect(m_ptOrigin,point),&brush);