📄 data.cpp
字号:
// Data.cpp: implementation of the CData class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "数字识别.h"
#include "Data.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CData::CData()
{
pdc = NULL;
for(int i = 0;i < 10; i++){
for(int j = 0;j < 14; j++){
data[i][j] = 0;
}
}
}
CData::~CData()
{
if(NULL != pdc){
delete pdc;
}
}
void CData::MoveTo(int x,int y){
if(NULL != pdc){
pdc->MoveTo(x,y);
}
}
void CData::LineTo(int x,int y){
if(NULL != pdc){
pdc->LineTo(x,y);
changed = TRUE;
}
}
void CData::SetDc(CDC * dc){
pdc = dc;
changed = FALSE;
}
void CData::Clear(){
CBitmap * bmp, * obp;
bmp = new CBitmap();
bmp->LoadBitmap(IDB_BG);
obp = pdc->SelectObject(bmp);
delete obp;
for(int i = 0;i < 10; i++){
for(int j = 0;j < 14; j++){
data[i][j] = 0;
}
}
changed = FALSE;
}
int CData::GetData(int x,int y){
return data[x][y];
}
void CData::Show(){
for(int x = 0;x < 10; x++){
for(int y = 0;y < 14; y++){
int i;
for(i = 0;i < 10; i++){
int j;
for(j = 0;j < 10; j++){
if(pdc->GetPixel(x*10 + i,y*10 + j) != RGB(255,255,255)){
data[x][y] = 1;
break;
}
}
if(j < 10){
break;
}
}
if(i >= 10){
data[x][y] = 0;
}
}
}
changed = FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -