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

📄 pdf417view.cpp

📁 对位图文件中的点阵数据进行模式判别,找出其中的完整PDF417条码,并按照GB/T 17172-1997规范来解释读出对应的数据.
💻 CPP
字号:
// pdf417View.cpp : implementation of the CPdf417View class
//

#include "stdafx.h"
#include "pdf417.h"

#include "pdf417Doc.h"
#include "pdf417View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPdf417View

IMPLEMENT_DYNCREATE(CPdf417View, CScrollView)

BEGIN_MESSAGE_MAP(CPdf417View, CScrollView)
	//{{AFX_MSG_MAP(CPdf417View)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPdf417View construction/destruction

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

}

CPdf417View::~CPdf417View()
{
}

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

	return CScrollView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CPdf417View drawing

void CPdf417View::OnDraw(CDC* pDC)
{
	CPdf417Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	if(!pDoc->m_filename.IsEmpty())
	{
		CBitmap bitmap;
		//调入文件
		HBITMAP hbitmap=(HBITMAP)::LoadImage(
			NULL,
			pDoc->m_filename,
			IMAGE_BITMAP,
			0,0,
			LR_LOADFROMFILE);

		bitmap.Attach(hbitmap);
		CDC dcComp;
		dcComp.CreateCompatibleDC(pDC);
		dcComp.SelectObject(&bitmap);

		BITMAP bmInfo;
		bitmap.GetObject(sizeof(BITMAP),&bmInfo);

		//设置View的滚动条范围
		CSize sizeTotal;
		sizeTotal.cx = bmInfo.bmWidth;
		sizeTotal.cy = bmInfo.bmHeight;
		SetScrollSizes(MM_TEXT,sizeTotal);

		pDC->BitBlt(0,0,bmInfo.bmWidth,bmInfo.bmHeight,
			&dcComp,0,0,SRCCOPY);
	}
}

void CPdf417View::OnInitialUpdate()
{
	CScrollView::OnInitialUpdate();

	CSize sizeTotal;
	// TODO: calculate the total size of this view
	sizeTotal.cx = sizeTotal.cy = 100;
	SetScrollSizes(MM_TEXT, sizeTotal);
}

/////////////////////////////////////////////////////////////////////////////
// CPdf417View diagnostics

#ifdef _DEBUG
void CPdf417View::AssertValid() const
{
	CScrollView::AssertValid();
}

void CPdf417View::Dump(CDumpContext& dc) const
{
	CScrollView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CPdf417View message handlers

⌨️ 快捷键说明

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