关键点
实现过程
void CCreateBrushView::OnDraw(CDC* pDC)
{
CCreateBrushDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
//创建画刷方法1;
LOGBRUSH lb;
lb.lbStyle =BS_HATCHED;
lb.lbColor=(COLORREF)0x00FF0000;
lb.lbHatch=HS_CROSS;
CBrush NewBrush1;
NewBrush1.CreateBrushIndirect(&lb);
CBrush* pOldBrush1=pDC->SelectObject(&NewBrush1);
pDC->Rectangle(50,50,200,300);
pDC->SelectObject(pOldBrush1);
//创建画刷方法2;
CBrush NewBrush2((COLORREF)0x0000FF00);
CBrush* pOldBrush2=pDC->SelectObject(&NewBrush2);
pDC->Rectangle(250,50,400,300);
pDC->SelectObject(pOldBrush2);
//创建画刷方法3;
CBrush NewBrush3(HS_BDIAGONAL,(COLORREF)0x000000FF);
CBrush* pOldBrush3=pDC->SelectObject(&NewBrush3);
pDC->Rectangle(450,50,600,300);
pDC->SelectObject(pOldBrush3);
} |
图
备注
相关链接