usingblobview.cpp

来自「< VISUAL C++ 数据库编程技术与实例>> 配套源码 」· C++ 代码 · 共 99 行

CPP
99
字号
// UsingBlobView.cpp : implementation of the CUsingBlobView class
//

#include "stdafx.h"
#include "UsingBlob.h"

#include "UsingBlobDoc.h"
#include "UsingBlobView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CUsingBlobView

IMPLEMENT_DYNCREATE(CUsingBlobView, CScrollView)

BEGIN_MESSAGE_MAP(CUsingBlobView, CScrollView)
	//{{AFX_MSG_MAP(CUsingBlobView)
		// 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()

/////////////////////////////////////////////////////////////////////////////
// CUsingBlobView construction/destruction

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

}

CUsingBlobView::~CUsingBlobView()
{
}

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

	return CScrollView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CUsingBlobView drawing

void CUsingBlobView::OnDraw(CDC* pDC)
{
	CUsingBlobDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

    CDC     memDC;

    memDC.CreateCompatibleDC(pDC);
    CBitmap* pImage     = memDC.SelectObject(&pDoc->m_Image);
    CSize    imageSize  = pDoc->m_Image.GetBitmapDimension();

    pDC->BitBlt(0,0,imageSize.cx,imageSize.cy,&memDC,0,0,SRCCOPY);

    memDC.SelectObject(pImage);

}

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

    SetScrollSizes(MM_TEXT,GetDocument()->m_Image.GetBitmapDimension());
}

/////////////////////////////////////////////////////////////////////////////
// CUsingBlobView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CUsingBlobView message handlers

⌨️ 快捷键说明

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