⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 字符编码view.cpp

📁 点阵数字、字符、汉字转换成ASCAII码.在EVC下编译通过
💻 CPP
字号:
// 字符编码View.cpp : implementation of the CMyView class
//

#include "stdafx.h"
#include "字符编码.h"

#include "字符编码Doc.h"
#include "字符编码View.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMyView

IMPLEMENT_DYNCREATE(CMyView, CView)

BEGIN_MESSAGE_MAP(CMyView, CView)
	//{{AFX_MSG_MAP(CMyView)
	ON_WM_LBUTTONUP()
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyView construction/destruction

CMyView::CMyView()
{
	// TODO: add construction code here

}

CMyView::~CMyView()
{
}

BOOL CMyView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMyView drawing
extern unsigned char ZFKCode[192];
unsigned char DisplayFlag[32][48];
void CMyView::OnDraw(CDC* pDC)
{
	CMyDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	int i,j;
//	pDC->FillSolidRect (0,0,500,500,60000);
	for(i = 0;i < 48;i ++){
		pDC->MoveTo (0,i * 10 + 10);
		pDC->LineTo (321,i * 10 + 10);
	}
	for(i = 0;i < 32;i ++){
		pDC->MoveTo (i * 10 + 10,0);
		pDC->LineTo (i * 10 + 10,481);
	}

	pDC->FillSolidRect (74,0,2,490,RGB(255,0,0)); 
	pDC->TextOut (70,491,"8");
	pDC->FillSolidRect (154,0,2,490,RGB(255,0,0)); 
	pDC->TextOut (148,491,"16");
	pDC->FillSolidRect (234,0,2,490,RGB(255,0,0)); 
	pDC->TextOut (228,491,"24");

	pDC->FillSolidRect (0,114,329,2,RGB(255,0,0));
	pDC->TextOut (330,108,"12");
	pDC->FillSolidRect (0,234,329,2,RGB(255,0,0));
	pDC->TextOut (330,228,"24");
	pDC->FillSolidRect (0,354,329,2,RGB(255,0,0));
	pDC->TextOut (330,348,"36");

	for(i = 0;i < 192;i ++)
		ZFKCode[i] = 0;
	for(i = 0;i < 32;i ++){
		for(j = 0;j < 48;j ++){
			if(DisplayFlag[i][j] == 1){
				pDC->FillSolidRect (i * 10 + 2,j * 10 + 2,7,7,RGB(0,0,0));
			}
		}
	}

//	pDC->Ellipse (200,200,300,300);

}

/////////////////////////////////////////////////////////////////////////////
// CMyView printing

BOOL CMyView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CMyView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CMyView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CMyView diagnostics

#ifdef _DEBUG
void CMyView::AssertValid() const
{
	CView::AssertValid();
}

void CMyView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CMyDoc* CMyView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMyDoc)));
	return (CMyDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMyView message handlers
CString strResult;
void CMyView::OnLButtonUp(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	CString strTemp;
	unsigned long lTemp;
	CDC *pDC;
	pDC = GetDC();
	
	if(point.x >= 320 || point.y >= 480)
		goto END;

	if(DisplayFlag[point.x/10][point.y/10] == 0){ 
		DisplayFlag[point.x/10][point.y/10] = 1;
		pDC->FillSolidRect((point.x/10) * 10 + 2,(point.y/10) * 10 + 2,7,7,0);
	}
	else{
		DisplayFlag[point.x/10][point.y/10] = 0;
		pDC->FillSolidRect((point.x/10) * 10 + 2,(point.y/10) * 10 + 2,7,7,RGB(255,255,255));
	}
//	lTemp = pDC->GetPixel (5,5);
//	strTemp.Format ("%x",lTemp);	//pDC->GetPixel (5,5));
//	pDC->SetPixel (25,25,lTemp);
//	MessageBox(strTemp);
END:	
	CView::OnLButtonUp(nFlags, point);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -