关于MFC图形填充问题。
我在voidCTextView::OnLButtonDown(UINTnFlags,CPointpoint)中先画了一个圆,填充了黄色:CClientDCdc(this)...
我在void CTextView::OnLButtonDown(UINT nFlags, CPoint point) 中先画了一个圆,填充了黄色:
CClientDC dc(this);
CBrush brush; // Must initialize!
brush.CreateSolidBrush(RGB(255,255,0));
CBrush* pTempBrush = NULL;
pTempBrush = (CBrush*)dc.SelectObject(brush);
dc.Ellipse (point.x-10, point.y-10, point.x+10, point.y+10);
dc.SelectObject(brush);
brush.DeleteObject();
然后根据不同条件画矩形填充蓝色:
CRect rcold(10+5*i/2+20,600-2*i/2,15+5*i/2+20,610);
CBrush pbrushl; // Must initialize!
pbrushl.CreateSolidBrush(RGB(48,245,61));
dc1.Rectangle(10+5*i/2+20,600-2*i/2,15+5*i/2+20,610); //矩形
dc1.FillRect(rcold,&pbrushl);
为什么执行填充蓝色矩形代码的时候把我上面圆的颜色给去掉变成透明的了呢?? 展开
CClientDC dc(this);
CBrush brush; // Must initialize!
brush.CreateSolidBrush(RGB(255,255,0));
CBrush* pTempBrush = NULL;
pTempBrush = (CBrush*)dc.SelectObject(brush);
dc.Ellipse (point.x-10, point.y-10, point.x+10, point.y+10);
dc.SelectObject(brush);
brush.DeleteObject();
然后根据不同条件画矩形填充蓝色:
CRect rcold(10+5*i/2+20,600-2*i/2,15+5*i/2+20,610);
CBrush pbrushl; // Must initialize!
pbrushl.CreateSolidBrush(RGB(48,245,61));
dc1.Rectangle(10+5*i/2+20,600-2*i/2,15+5*i/2+20,610); //矩形
dc1.FillRect(rcold,&pbrushl);
为什么执行填充蓝色矩形代码的时候把我上面圆的颜色给去掉变成透明的了呢?? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询