透明画刷的使用
代码部分
CRect rect;
GetClientRect(rect);
pDC ->SetMapMode(MM_ANISOTROPIC);
pDC ->SetWindowExt(rect.Width(), rect.Height());
pDC ->SetViewportExt(rect.Width(), -rect.Height());
pDC ->SetViewportOrg(rect.Width()/2, rect.Height()/2);
rect.OffsetRect(-rect.Width()/2, -rect.Height()/2);
rect.DeflateRect(100, 100);
CBrush NewBrush, *pOldBrush;
pOldBrush = (CBrush *)pDC ->SelectStockObject(NULL_BRUSH);
int r = rect.Height()/2;
CRect rect1(CPoint(-r, -r), CPoint(r, r));
pDC ->Ellipse(rect1);
pDC ->Ellipse(rect);
pDC ->Rectangle(rect);
pDC ->SelectObject(pOldBrush);
关键部分
CBrush NewBrush, *pOldBrush;
pOldBrush = (CBrush *)pDC ->SelectStockObject(NULL_BRUSH);
有个类型强制转换。