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

📄 cropview.cpp

📁 《Visual C++ Bible》或者说是《Visual C++ 宝典》的对应的源码文件
💻 CPP
字号:
// CropView.cpp : implementation of the CCropView class
//

#include "stdafx.h"
#include "Crop.h"

#include "CropDoc.h"
#include "CropView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCropView

IMPLEMENT_DYNCREATE(CCropView, CView)

BEGIN_MESSAGE_MAP(CCropView, CView)
	//{{AFX_MSG_MAP(CCropView)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCropView construction/destruction

CCropView::CCropView()
{

	m_pImageObject = NULL;

}

CCropView::~CCropView()
{

	if( m_pImageObject != NULL )
		delete m_pImageObject;

}

BOOL CCropView::PreCreateWindow(CREATESTRUCT& cs)
{
	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CCropView drawing

void CCropView::OnDraw(CDC* pDC)
{
	CCropDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	if( m_pImageObject == NULL ){
		m_pImageObject = new CImageObject( "FILE.BMP" );
		m_pImageObject->Crop( 10, 10, 150, 150 );
		}

	if( m_pImageObject != NULL ){
		if( GetFocus() == this )
			m_pImageObject->SetPalette( pDC );
		m_pImageObject->Draw( pDC );
		}

}

/////////////////////////////////////////////////////////////////////////////
// CCropView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CCropView message handlers

⌨️ 快捷键说明

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