?? pdf417view.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 + -