五子棋游戏
基于C++ MFC实现的的五子棋游戏
主要功能
1、棋盘棋子绘制
棋盘绘制
void CMy05gobangView::OnPaint()
{
// 不要为绘制消息而调用 CWnd::OnPaint()
SetWindowPos(NULL,0,0,800,630,SWP_NOMOVE);
CPaintDC dc(this); // 用于绘制的设备上下文
CRect rect;
GetClientRect(rect);
switch(mColor)
{
case 0:
{
dc.FillSolidRect(rect,RGB(0,255,0));
}
break;
case 1:
{
dc.FillSolidRect(rect,RGB(0,0,255));
}
break;
case 2:
{
dc.FillSolidRect(rect,RGB(255,255,0));
}
break;
default:
break;
}
CClientDC cdc(this);
for(int i = 40;i <= 600;i = i + 40)
{
cdc.MoveTo(40,i);
cdc.LineTo(600,i);
cdc.MoveTo(i,40);
cdc.LineTo(i,600);
}
CDC *pDC;
pDC = GetDC();
CBrush brush;
brush.CreateSolidBrush(RGB(0,0,0));
CBrush *pOldBrush;
CBrush brush2;
brush2.CreateSolidBrush(RGB(255,255,255));
CBrush *pOldBrush2;
for(int j =0;j < 15;j++)