📄 boarddraw.cpp
字号:
// BoardDraw.cpp: implementation of the BoardDraw class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Draw.h"
#include "BoardDraw.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
BoardDraw::BoardDraw() {
m_pDC = NULL;
}
BoardDraw::~BoardDraw() {
m_pDC = NULL;
}
BoardDraw::BoardDraw(CDC *pDC) {
m_pDC = pDC;
}
void BoardDraw::SetForeColor(const COLORREF & color) {
m_forecolor = color;
}
void BoardDraw::Rectangle(int x1, int y1, int x2, int y2) {
CPen thepen;
thepen.CreatePen(PS_SOLID,1,m_forecolor);
m_pDC->SelectObject(&thepen);
CBrush thebrush;
thebrush.CreateSolidBrush(0xffffff);
m_pDC->SelectObject(&thebrush);
m_pDC->Rectangle(x1,y1,x2,y2);
}
void BoardDraw::DrawBlock(int x1, int y1, int x2, int y2) {
CPen thepen;
thepen.CreatePen(PS_SOLID,1,0xff0000);
m_pDC->SelectObject(&thepen);
CBrush thebrush;
thebrush.CreateSolidBrush(0xF70894);
m_pDC->SelectObject(&thebrush);
m_pDC->Rectangle(x1,y1,x2,y2);
}
void BoardDraw::DrawWall(int x1, int y1, int x2, int y2) {
CBrush thebrush;
thebrush.CreateSolidBrush(0x000011);
m_pDC->SelectObject(&thebrush);
CPen thepen;
thepen.CreatePen(PS_SOLID,1,0xff0000);
m_pDC->SelectObject(&thepen);
m_pDC->Rectangle(x1,y1,x2,y2);
}
void BoardDraw::Circle(int x1, int y1, int x2, int y2, int nOffset) {
CPen thepen;
thepen.CreatePen(PS_SOLID,1,m_forecolor);
m_pDC->SelectObject(&thepen);
CBrush thebrush;
thebrush.CreateSolidBrush(0x0000ff);
m_pDC->SelectObject(&thebrush);
x1 = x1 + nOffset ;
y1 = y1 + nOffset ;
x2 = x2 - nOffset ;
y2 = y2 - nOffset ;
m_pDC->Ellipse(x1,y1,x2,y2);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -