VS2005 CBRUSH笔刷的使用

void CTESTView::OnDraw(CDC* pDC)

{

CTESTDoc* pDoc = GetDocument();

ASSERT_VALID(pDoc);

 

// TODO: 在此处为本机数据添加绘制代码

 

//创建笔刷

CBrush brush,brushold;

brush.CreateSolidBrush(RGB(0,255,0));

CBrush* pTempBrush = NULL;

CBrush OrigBrush;

CRect rc;

GetClientRect(&rc);

ScreenToClient(&rc);

pTempBrush = (CBrush*)pDC->SelectObject(&brush);

  // Save original brush.

OrigBrush.FromHandle((HBRUSH)pTempBrush);

pDC->Rectangle(0, 0, rc.Width() / 2, rc.Height() / 2);

   // Reselect original brush into device context.

   pDC->SelectObject(&OrigBrush);

}

你可能感兴趣的:(VS2005 CBRUSH笔刷的使用)