刚学MFC。尝试写五子棋。。用黑色画刷画棋子。。但是运行后。黑色棋子会慢慢褪色。甚至大部分变白。。请帮忙分析或猜测一下原因。并说说解决方法和涉及到的知识。。我好去查找资料。谢谢了。画棋子代码如下:(应该没错)
CBrush*brush=new CBrush(RGB(0,0,0)); //定义黑色的画刷
CDC*pDC=this->GetDC(); //获取当前设备的指针
pDC->SelectObject(brush); //选中该画刷
for(int i=25;i<500;i+=25)
{
for(int j=25;j<500;j+=25)
{
CRect rect(i,j,i+25,j+25); //每格从新定义一个矩形
if(rect.PtInRect(point))
{
CPoint centerpoint; //定义矩形中心坐标
centerpoint=rect.CenterPoint(); //获取矩形中心坐标
pDC->Ellipse(centerpoint.x-10,centerpoint.y-10,
centerpoint.x+10,centerpoint.y+10);
//以矩形中心坐标为圆心画圆
}
}
}
CBrush*brush=new CBrush(RGB(0,0,0)); //定义黑色的画刷
CDC*pDC=this->GetDC(); //获取当前设备的指针
pDC->SelectObject(brush); //选中该画刷
for(int i=25;i<500;i+=25)
{
for(int j=25;j<500;j+=25)
{
CRect rect(i,j,i+25,j+25); //每格从新定义一个矩形
if(rect.PtInRect(point))
{
CPoint centerpoint; //定义矩形中心坐标
centerpoint=rect.CenterPoint(); //获取矩形中心坐标
pDC->Ellipse(centerpoint.x-10,centerpoint.y-10,
centerpoint.x+10,centerpoint.y+10);
//以矩形中心坐标为圆心画圆
}
}
}
